using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Ropin.Inspection.Model.Migrations
{
    public partial class EditStore : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            //migrationBuilder.DropForeignKey(
            //  name: "FK_TPNT_TypeTPNT_Store_Code",
            //  table: "TPNT_Store");

            //migrationBuilder.DropForeignKey(
            //   name: "FK_TSYS_LicenseTPNT_Store_Code",
            //   table: "TPNT_Store");

            migrationBuilder.DropForeignKey(
                name: "FK_TBDM_Area_TBDM_City_C_CityCode",
                table: "TBDM_Area");

            migrationBuilder.DropForeignKey(
                name: "FK_TBDM_City_TBDM_Prov_C_ProvCode",
                table: "TBDM_City");

            migrationBuilder.DropForeignKey(
                name: "FK_TBDM_CodeDetail_TSYS_User_C_CreateBy",
                table: "TBDM_CodeDetail");

            migrationBuilder.DropForeignKey(
                name: "FK_TBDM_CodeMain_TSYS_User_C_CreateBy",
                table: "TBDM_CodeMain");

            migrationBuilder.DropForeignKey(
                name: "FK_TDEV_DevAlertConfig_TSYS_User_C_CreateBy",
                table: "TDEV_DevAlertConfig");

            migrationBuilder.DropForeignKey(
                name: "FK_TDEV_DevDataConfig_TSYS_User_C_CreateBy",
                table: "TDEV_DevDataConfig");

            migrationBuilder.DropForeignKey(
                name: "FK_TDEV_Device_TSYS_User_C_CreateBy",
                table: "TDEV_Device");

            migrationBuilder.DropForeignKey(
                name: "FK_TPNT_Area_TPNT_Store_C_StoreCode",
                table: "TPNT_Area");

            migrationBuilder.DropForeignKey(
                name: "FK_TPNT_Area_TSYS_User_C_CreateBy",
                table: "TPNT_Area");

            migrationBuilder.DropForeignKey(
                name: "FK_TPNT_Store_TSYS_User_C_CreateBy",
                table: "TPNT_Store");

            migrationBuilder.DropForeignKey(
                name: "FK_TPNT_StoreOrg_TSYS_User_C_CreateBy",
                table: "TPNT_StoreOrg");

            migrationBuilder.DropForeignKey(
                name: "FK_TPRD_ProdSKU_TSYS_User_C_CreateBy",
                table: "TPRD_ProdSKU");

            migrationBuilder.DropForeignKey(
                name: "FK_TPRD_Product_TSYS_User_C_CreateBy",
                table: "TPRD_Product");

            migrationBuilder.DropForeignKey(
                name: "FK_TPRD_Type_TSYS_User_C_CreateBy",
                table: "TPRD_Type");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_License_TSYS_LicenseType_C_TypeCode",
                table: "TSYS_License");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_License_TSYS_User_C_CreateBy",
                table: "TSYS_License");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_LicenseType_TSYS_User_C_CreateBy",
                table: "TSYS_LicenseType");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_LicenseTypePriv_TSYS_LicenseType_C_LicenseTypeCode",
                table: "TSYS_LicenseTypePriv");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_LicenseTypePriv_TSYS_Priv_C_PrivilegeCode",
                table: "TSYS_LicenseTypePriv");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_LicenseTypePriv_TSYS_User_C_CreateBy",
                table: "TSYS_LicenseTypePriv");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_Message_TSYS_User_C_CreateBy",
                table: "TSYS_Message");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_Message_TSYS_User_C_UserID",
                table: "TSYS_Message");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_Org_TSYS_Org_C_ParentCode",
                table: "TSYS_Org");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_Org_TSYS_User_C_CreateBy",
                table: "TSYS_Org");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_Role_TSYS_User_C_CreateBy",
                table: "TSYS_Role");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_RolePriv_TSYS_Role_C_RoleCode",
                table: "TSYS_RolePriv");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_RolePriv_TSYS_User_C_CreateBy",
                table: "TSYS_RolePriv");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_User_TSYS_User_C_CreateBy",
                table: "TSYS_User");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_UserRole_TSYS_Role_C_RoleCode",
                table: "TSYS_UserRole");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_UserRole_TSYS_User_C_CreateBy",
                table: "TSYS_UserRole");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_UserRole_TSYS_User_C_UserCode",
                table: "TSYS_UserRole");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_Version_TSYS_User_C_CreateBy",
                table: "TSYS_Version");

            migrationBuilder.AddColumn<Guid>(
                name: "LicenseC_ID",
                table: "TPNT_Store",
                type: "char(36)",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_TPNT_Store_LicenseC_ID",
                table: "TPNT_Store",
                column: "LicenseC_ID");

            migrationBuilder.AddForeignKey(
                name: "FK_TBDM_Area_TBDM_City_C_CityCode",
                table: "TBDM_Area",
                column: "C_CityCode",
                principalTable: "TBDM_City",
                principalColumn: "C_Code",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TBDM_City_TBDM_Prov_C_ProvCode",
                table: "TBDM_City",
                column: "C_ProvCode",
                principalTable: "TBDM_Prov",
                principalColumn: "C_Code",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TBDM_CodeDetail_TSYS_User_C_CreateBy",
                table: "TBDM_CodeDetail",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TBDM_CodeMain_TSYS_User_C_CreateBy",
                table: "TBDM_CodeMain",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TDEV_DevAlertConfig_TSYS_User_C_CreateBy",
                table: "TDEV_DevAlertConfig",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TDEV_DevDataConfig_TSYS_User_C_CreateBy",
                table: "TDEV_DevDataConfig",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TDEV_Device_TSYS_User_C_CreateBy",
                table: "TDEV_Device",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TPNT_Area_TPNT_Store_C_StoreCode",
                table: "TPNT_Area",
                column: "C_StoreCode",
                principalTable: "TPNT_Store",
                principalColumn: "C_ID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TPNT_Area_TSYS_User_C_CreateBy",
                table: "TPNT_Area",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TPNT_Store_TSYS_License_LicenseC_ID",
                table: "TPNT_Store",
                column: "LicenseC_ID",
                principalTable: "TSYS_License",
                principalColumn: "C_ID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TPNT_Store_TSYS_User_C_CreateBy",
                table: "TPNT_Store",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TPNT_StoreOrg_TSYS_User_C_CreateBy",
                table: "TPNT_StoreOrg",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TPRD_ProdSKU_TSYS_User_C_CreateBy",
                table: "TPRD_ProdSKU",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TPRD_Product_TSYS_User_C_CreateBy",
                table: "TPRD_Product",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TPRD_Type_TSYS_User_C_CreateBy",
                table: "TPRD_Type",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_License_TSYS_LicenseType_C_TypeCode",
                table: "TSYS_License",
                column: "C_TypeCode",
                principalTable: "TSYS_LicenseType",
                principalColumn: "C_Code",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_License_TSYS_User_C_CreateBy",
                table: "TSYS_License",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_LicenseType_TSYS_User_C_CreateBy",
                table: "TSYS_LicenseType",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_LicenseTypePriv_TSYS_LicenseType_C_LicenseTypeCode",
                table: "TSYS_LicenseTypePriv",
                column: "C_LicenseTypeCode",
                principalTable: "TSYS_LicenseType",
                principalColumn: "C_Code",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_LicenseTypePriv_TSYS_Priv_C_PrivilegeCode",
                table: "TSYS_LicenseTypePriv",
                column: "C_PrivilegeCode",
                principalTable: "TSYS_Priv",
                principalColumn: "C_Code",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_LicenseTypePriv_TSYS_User_C_CreateBy",
                table: "TSYS_LicenseTypePriv",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_Message_TSYS_User_C_CreateBy",
                table: "TSYS_Message",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_Message_TSYS_User_C_UserID",
                table: "TSYS_Message",
                column: "C_UserID",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_Org_TSYS_Org_C_ParentCode",
                table: "TSYS_Org",
                column: "C_ParentCode",
                principalTable: "TSYS_Org",
                principalColumn: "K_ID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_Org_TSYS_User_C_CreateBy",
                table: "TSYS_Org",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_Role_TSYS_User_C_CreateBy",
                table: "TSYS_Role",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_RolePriv_TSYS_Role_C_RoleCode",
                table: "TSYS_RolePriv",
                column: "C_RoleCode",
                principalTable: "TSYS_Role",
                principalColumn: "C_Code",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_RolePriv_TSYS_User_C_CreateBy",
                table: "TSYS_RolePriv",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_User_TSYS_User_C_CreateBy",
                table: "TSYS_User",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_UserRole_TSYS_Role_C_RoleCode",
                table: "TSYS_UserRole",
                column: "C_RoleCode",
                principalTable: "TSYS_Role",
                principalColumn: "C_Code",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_UserRole_TSYS_User_C_CreateBy",
                table: "TSYS_UserRole",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_UserRole_TSYS_User_C_UserCode",
                table: "TSYS_UserRole",
                column: "C_UserCode",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_Version_TSYS_User_C_CreateBy",
                table: "TSYS_Version",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_TBDM_Area_TBDM_City_C_CityCode",
                table: "TBDM_Area");

            migrationBuilder.DropForeignKey(
                name: "FK_TBDM_City_TBDM_Prov_C_ProvCode",
                table: "TBDM_City");

            migrationBuilder.DropForeignKey(
                name: "FK_TBDM_CodeDetail_TSYS_User_C_CreateBy",
                table: "TBDM_CodeDetail");

            migrationBuilder.DropForeignKey(
                name: "FK_TBDM_CodeMain_TSYS_User_C_CreateBy",
                table: "TBDM_CodeMain");

            migrationBuilder.DropForeignKey(
                name: "FK_TDEV_DevAlertConfig_TSYS_User_C_CreateBy",
                table: "TDEV_DevAlertConfig");

            migrationBuilder.DropForeignKey(
                name: "FK_TDEV_DevDataConfig_TSYS_User_C_CreateBy",
                table: "TDEV_DevDataConfig");

            migrationBuilder.DropForeignKey(
                name: "FK_TDEV_Device_TSYS_User_C_CreateBy",
                table: "TDEV_Device");

            //migrationBuilder.DropForeignKey(
            //    name: "FK_TPNT_Area_TPNT_Store_C_StoreCode",
            //    table: "TPNT_Area");

            migrationBuilder.DropForeignKey(
                name: "FK_TPNT_Area_TSYS_User_C_CreateBy",
                table: "TPNT_Area");

            migrationBuilder.DropForeignKey(
                name: "FK_TPNT_Store_TSYS_License_LicenseC_ID",
                table: "TPNT_Store");

            migrationBuilder.DropForeignKey(
                name: "FK_TPNT_Store_TSYS_User_C_CreateBy",
                table: "TPNT_Store");

            migrationBuilder.DropForeignKey(
                name: "FK_TPNT_StoreOrg_TSYS_User_C_CreateBy",
                table: "TPNT_StoreOrg");

            migrationBuilder.DropForeignKey(
                name: "FK_TPRD_ProdSKU_TSYS_User_C_CreateBy",
                table: "TPRD_ProdSKU");

            migrationBuilder.DropForeignKey(
                name: "FK_TPRD_Product_TSYS_User_C_CreateBy",
                table: "TPRD_Product");

            migrationBuilder.DropForeignKey(
                name: "FK_TPRD_Type_TSYS_User_C_CreateBy",
                table: "TPRD_Type");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_License_TSYS_LicenseType_C_TypeCode",
                table: "TSYS_License");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_License_TSYS_User_C_CreateBy",
                table: "TSYS_License");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_LicenseType_TSYS_User_C_CreateBy",
                table: "TSYS_LicenseType");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_LicenseTypePriv_TSYS_LicenseType_C_LicenseTypeCode",
                table: "TSYS_LicenseTypePriv");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_LicenseTypePriv_TSYS_Priv_C_PrivilegeCode",
                table: "TSYS_LicenseTypePriv");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_LicenseTypePriv_TSYS_User_C_CreateBy",
                table: "TSYS_LicenseTypePriv");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_Message_TSYS_User_C_CreateBy",
                table: "TSYS_Message");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_Message_TSYS_User_C_UserID",
                table: "TSYS_Message");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_Org_TSYS_Org_C_ParentCode",
                table: "TSYS_Org");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_Org_TSYS_User_C_CreateBy",
                table: "TSYS_Org");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_Role_TSYS_User_C_CreateBy",
                table: "TSYS_Role");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_RolePriv_TSYS_Role_C_RoleCode",
                table: "TSYS_RolePriv");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_RolePriv_TSYS_User_C_CreateBy",
                table: "TSYS_RolePriv");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_User_TSYS_User_C_CreateBy",
                table: "TSYS_User");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_UserRole_TSYS_Role_C_RoleCode",
                table: "TSYS_UserRole");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_UserRole_TSYS_User_C_CreateBy",
                table: "TSYS_UserRole");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_UserRole_TSYS_User_C_UserCode",
                table: "TSYS_UserRole");

            migrationBuilder.DropForeignKey(
                name: "FK_TSYS_Version_TSYS_User_C_CreateBy",
                table: "TSYS_Version");

            migrationBuilder.DropIndex(
                name: "IX_TPNT_Store_LicenseC_ID",
                table: "TPNT_Store");

            migrationBuilder.DropColumn(
                name: "LicenseC_ID",
                table: "TPNT_Store");

            migrationBuilder.AddForeignKey(
                name: "FK_TBDM_Area_TBDM_City_C_CityCode",
                table: "TBDM_Area",
                column: "C_CityCode",
                principalTable: "TBDM_City",
                principalColumn: "C_Code",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TBDM_City_TBDM_Prov_C_ProvCode",
                table: "TBDM_City",
                column: "C_ProvCode",
                principalTable: "TBDM_Prov",
                principalColumn: "C_Code",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TBDM_CodeDetail_TSYS_User_C_CreateBy",
                table: "TBDM_CodeDetail",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TBDM_CodeMain_TSYS_User_C_CreateBy",
                table: "TBDM_CodeMain",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TDEV_DevAlertConfig_TSYS_User_C_CreateBy",
                table: "TDEV_DevAlertConfig",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TDEV_DevDataConfig_TSYS_User_C_CreateBy",
                table: "TDEV_DevDataConfig",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TDEV_Device_TSYS_User_C_CreateBy",
                table: "TDEV_Device",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            //migrationBuilder.AddForeignKey(
            //    name: "FK_TPNT_Area_TPNT_Store_C_StoreCode",
            //    table: "TPNT_Area",
            //    column: "C_StoreCode",
            //    principalTable: "TPNT_Store",
            //    principalColumn: "C_ID",
            //    onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TPNT_Area_TSYS_User_C_CreateBy",
                table: "TPNT_Area",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TPNT_Store_TSYS_User_C_CreateBy",
                table: "TPNT_Store",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TPNT_StoreOrg_TSYS_User_C_CreateBy",
                table: "TPNT_StoreOrg",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TPRD_ProdSKU_TSYS_User_C_CreateBy",
                table: "TPRD_ProdSKU",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TPRD_Product_TSYS_User_C_CreateBy",
                table: "TPRD_Product",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TPRD_Type_TSYS_User_C_CreateBy",
                table: "TPRD_Type",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_License_TSYS_LicenseType_C_TypeCode",
                table: "TSYS_License",
                column: "C_TypeCode",
                principalTable: "TSYS_LicenseType",
                principalColumn: "C_Code",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_License_TSYS_User_C_CreateBy",
                table: "TSYS_License",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_LicenseType_TSYS_User_C_CreateBy",
                table: "TSYS_LicenseType",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_LicenseTypePriv_TSYS_LicenseType_C_LicenseTypeCode",
                table: "TSYS_LicenseTypePriv",
                column: "C_LicenseTypeCode",
                principalTable: "TSYS_LicenseType",
                principalColumn: "C_Code",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_LicenseTypePriv_TSYS_Priv_C_PrivilegeCode",
                table: "TSYS_LicenseTypePriv",
                column: "C_PrivilegeCode",
                principalTable: "TSYS_Priv",
                principalColumn: "C_Code",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_LicenseTypePriv_TSYS_User_C_CreateBy",
                table: "TSYS_LicenseTypePriv",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_Message_TSYS_User_C_CreateBy",
                table: "TSYS_Message",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_Message_TSYS_User_C_UserID",
                table: "TSYS_Message",
                column: "C_UserID",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_Org_TSYS_Org_C_ParentCode",
                table: "TSYS_Org",
                column: "C_ParentCode",
                principalTable: "TSYS_Org",
                principalColumn: "K_ID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_Org_TSYS_User_C_CreateBy",
                table: "TSYS_Org",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_Role_TSYS_User_C_CreateBy",
                table: "TSYS_Role",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_RolePriv_TSYS_Role_C_RoleCode",
                table: "TSYS_RolePriv",
                column: "C_RoleCode",
                principalTable: "TSYS_Role",
                principalColumn: "C_Code",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_RolePriv_TSYS_User_C_CreateBy",
                table: "TSYS_RolePriv",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_User_TSYS_User_C_CreateBy",
                table: "TSYS_User",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_UserRole_TSYS_Role_C_RoleCode",
                table: "TSYS_UserRole",
                column: "C_RoleCode",
                principalTable: "TSYS_Role",
                principalColumn: "C_Code",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_UserRole_TSYS_User_C_CreateBy",
                table: "TSYS_UserRole",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_UserRole_TSYS_User_C_UserCode",
                table: "TSYS_UserRole",
                column: "C_UserCode",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TSYS_Version_TSYS_User_C_CreateBy",
                table: "TSYS_Version",
                column: "C_CreateBy",
                principalTable: "TSYS_User",
                principalColumn: "C_UserID",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
             name: "FK_TSYS_LicenseTPNT_Store_Code",
             table: "TPNT_Store",
             column: "C_LicenseCode",
             principalTable: "TSYS_License",
             principalColumn: "C_Code",
             onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
             name: "FK_TPNT_StoreOrgTPNT_Store_Code",
             table: "TPNT_StoreOrg",
             column: "C_StoreCode",
             principalTable: "TPNT_Store",
             principalColumn: "C_Code",
             onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
              name: "FK_TPNT_StoreOrgTSYS_OrgC_OrgCode",
              table: "TPNT_StoreOrg",
              column: "C_OrgCode",
              principalTable: "TSYS_Org",
              principalColumn: "C_Code",
              onDelete: ReferentialAction.Restrict);

            //migrationBuilder.AddForeignKey(
            //  name: "FK_TPNT_TypeTPNT_Store_Code",
            //  table: "TPNT_Store",
            //  column: "C_TypeCode",
            //  principalTable: "TPNT_Type",
            //  principalColumn: "C_Code",
            //  onDelete: ReferentialAction.Restrict);
        }
    }
}