using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Ropin.Inspection.Model.Migrations
{
    public partial class Init02 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Report",
                columns: table => new
                {
                    G_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Name = table.Column<string>(type: "longtext CHARACTER SET utf8mb4", nullable: true),
                    I_Type = table.Column<int>(type: "int", nullable: false),
                    C_GroupName = table.Column<string>(type: "longtext CHARACTER SET utf8mb4", nullable: true),
                    D_CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    D_Start = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    D_End = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_Data = table.Column<string>(type: "longtext CHARACTER SET utf8mb4", nullable: true),
                    C_Remark = table.Column<string>(type: "longtext CHARACTER SET utf8mb4", nullable: true),
                    C_Status = table.Column<string>(type: "longtext CHARACTER SET utf8mb4", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Report", x => x.G_ID);
                });

            migrationBuilder.CreateTable(
                name: "TasksQz",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_LicenseCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    Name = table.Column<string>(type: "varchar(200) CHARACTER SET utf8mb4", maxLength: 200, nullable: true),
                    JobGroup = table.Column<string>(type: "varchar(200) CHARACTER SET utf8mb4", maxLength: 200, nullable: true),
                    Cron = table.Column<string>(type: "varchar(200) CHARACTER SET utf8mb4", maxLength: 200, nullable: true),
                    AssemblyName = table.Column<string>(type: "varchar(200) CHARACTER SET utf8mb4", maxLength: 200, nullable: true),
                    ClassName = table.Column<string>(type: "varchar(200) CHARACTER SET utf8mb4", maxLength: 200, nullable: true),
                    Remark = table.Column<string>(type: "varchar(1000) CHARACTER SET utf8mb4", maxLength: 1000, nullable: true),
                    RunTimes = table.Column<int>(type: "int", nullable: false),
                    BeginTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    EndTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    TriggerType = table.Column<int>(type: "int", nullable: false),
                    IntervalSecond = table.Column<int>(type: "int", nullable: false),
                    CycleRunTimes = table.Column<int>(type: "int", nullable: false),
                    IsStart = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    JobParams = table.Column<string>(type: "longtext CHARACTER SET utf8mb4", nullable: true),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: true),
                    CreateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreateBy = table.Column<Guid>(type: "char(36)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TasksQz", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TBDM_Prov",
                columns: table => new
                {
                    C_Code = table.Column<string>(type: "varchar(20) CHARACTER SET utf8mb4", maxLength: 20, nullable: false),
                    C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBDM_Prov", x => x.C_Code);
                });

            migrationBuilder.CreateTable(
                name: "TDEV_DevAlert",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_DeviceCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_ConfigCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Value = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TDEV_DevAlert", x => x.C_ID);
                });

            migrationBuilder.CreateTable(
                name: "TDEV_DevData",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_DeviceCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_ConfigCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Value = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TDEV_DevData", x => x.C_ID);
                });

            migrationBuilder.CreateTable(
                name: "TISP_RecordAlarm",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_InspectionRecordCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_SpotContentCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TISP_RecordAlarm", x => x.C_ID);
                });

            migrationBuilder.CreateTable(
                name: "TPNT_Type",
                columns: table => new
                {
                    C_Code = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TPNT_Type", x => x.C_Code);
                });

            migrationBuilder.CreateTable(
                name: "TPRD_Log",
                columns: table => new
                {
                    C_Code = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_ProductCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    I_Type = table.Column<int>(type: "int", nullable: false),
                    C_StoreCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_DeviceCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
                    C_SpotCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
                    C_AlarmMsg = table.Column<string>(type: "varchar(1024) CHARACTER SET utf8mb4", maxLength: 1024, nullable: true),
                    C_Remark = table.Column<string>(type: "varchar(1024) CHARACTER SET utf8mb4", maxLength: 1024, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TPRD_Log", x => x.C_Code);
                });

            migrationBuilder.CreateTable(
                name: "TSEC_RecordImage",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_SecurityRecordCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_ImageURL = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TSEC_RecordImage", x => x.C_ID);
                });

            migrationBuilder.CreateTable(
                name: "TSYS_Organize",
                columns: table => new
                {
                    G_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    G_ParentCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Number = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
                    C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_ParentName = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
                    C_ParentCodeList = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    I_Layer = table.Column<int>(type: "int", nullable: false),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Address = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: true),
                    C_GPS = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: true),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_ImageUrl = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: true),
                    G_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    G_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TSYS_Organize", x => x.G_ID);
                });

            migrationBuilder.CreateTable(
                name: "TSYS_Post",
                columns: table => new
                {
                    G_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Code = table.Column<string>(type: "varchar(20) CHARACTER SET utf8mb4", maxLength: 20, nullable: false),
                    C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: true),
                    G_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    G_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TSYS_Post", x => x.G_ID);
                });

            migrationBuilder.CreateTable(
                name: "TSYS_Priv",
                columns: table => new
                {
                    C_Code = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_ParentCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
                    C_Module = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Type = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_ImageUrl = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_PageUrl = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_Remark = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: true),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TSYS_Priv", x => x.C_Code);
                    table.ForeignKey(
                        name: "FK_TSYS_Priv_TSYS_Priv_C_ParentCode",
                        column: x => x.C_ParentCode,
                        principalTable: "TSYS_Priv",
                        principalColumn: "C_Code",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TSYS_User",
                columns: table => new
                {
                    C_UserID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_LicenseCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Post = table.Column<Guid>(type: "char(36)", nullable: true),
                    C_UserName = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_WechatID = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: true),
                    C_ProgramID = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: true),
                    C_Password = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: false),
                    C_Name = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: false),
                    I_Render = table.Column<int>(type: "int", nullable: false),
                    C_IDNum = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: true),
                    C_OrgCode = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: false),
                    C_ImagePath = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    D_BirthDay = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_Address = table.Column<string>(type: "varchar(255) CHARACTER SET utf8mb4", maxLength: 255, nullable: true),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Mobile = table.Column<string>(type: "varchar(20) CHARACTER SET utf8mb4", maxLength: 20, nullable: true),
                    C_Phone = table.Column<string>(type: "varchar(20) CHARACTER SET utf8mb4", maxLength: 20, nullable: true),
                    C_Email = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TSYS_User", x => x.C_UserID);
                    table.ForeignKey(
                        name: "FK_TSYS_User_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TSYS_User_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TSYS_UserPost",
                columns: table => new
                {
                    G_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    G_UserCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    G_PostCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    G_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TSYS_UserPost", x => x.G_ID);
                });

            migrationBuilder.CreateTable(
                name: "TaskInfoDto",
                columns: table => new
                {
                    jobId = table.Column<string>(type: "varchar(255) CHARACTER SET utf8mb4", nullable: false),
                    jobName = table.Column<string>(type: "longtext CHARACTER SET utf8mb4", nullable: true),
                    jobGroup = table.Column<string>(type: "longtext CHARACTER SET utf8mb4", nullable: true),
                    triggerId = table.Column<string>(type: "longtext CHARACTER SET utf8mb4", nullable: true),
                    triggerName = table.Column<string>(type: "longtext CHARACTER SET utf8mb4", nullable: true),
                    triggerGroup = table.Column<string>(type: "longtext CHARACTER SET utf8mb4", nullable: true),
                    triggerStatus = table.Column<string>(type: "longtext CHARACTER SET utf8mb4", nullable: true),
                    TasksQzId = table.Column<Guid>(type: "char(36)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TaskInfoDto", x => x.jobId);
                    table.ForeignKey(
                        name: "FK_TaskInfoDto_TasksQz_TasksQzId",
                        column: x => x.TasksQzId,
                        principalTable: "TasksQz",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TBDM_City",
                columns: table => new
                {
                    C_Code = table.Column<string>(type: "varchar(20) CHARACTER SET utf8mb4", maxLength: 20, nullable: false),
                    C_ProvCode = table.Column<string>(type: "varchar(20) CHARACTER SET utf8mb4", maxLength: 20, nullable: false),
                    C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBDM_City", x => x.C_Code);
                    table.ForeignKey(
                        name: "FK_TBDM_City_TBDM_Prov_C_ProvCode",
                        column: x => x.C_ProvCode,
                        principalTable: "TBDM_Prov",
                        principalColumn: "C_Code",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TBDM_CodeDetail",
                columns: table => new
                {
                    C_Code = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_MainCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Value = table.Column<string>(type: "varchar(255) CHARACTER SET utf8mb4", maxLength: 255, nullable: false),
                    C_IsSys = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false),
                    C_Default = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBDM_CodeDetail", x => x.C_Code);
                    table.ForeignKey(
                        name: "FK_TBDM_CodeDetail_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TBDM_CodeDetail_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TBDM_CodeMain",
                columns: table => new
                {
                    C_Code = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBDM_CodeMain", x => x.C_Code);
                    table.ForeignKey(
                        name: "FK_TBDM_CodeMain_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TBDM_CodeMain_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TDEV_DevAlertConfig",
                columns: table => new
                {
                    C_Code = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(1024) CHARACTER SET utf8mb4", maxLength: 1024, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TDEV_DevAlertConfig", x => x.C_Code);
                    table.ForeignKey(
                        name: "FK_TDEV_DevAlertConfig_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TDEV_DevAlertConfig_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TDEV_DevDataConfig",
                columns: table => new
                {
                    C_Code = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    I_Interval = table.Column<int>(type: "int", nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(1024) CHARACTER SET utf8mb4", maxLength: 1024, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TDEV_DevDataConfig", x => x.C_Code);
                    table.ForeignKey(
                        name: "FK_TDEV_DevDataConfig_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TDEV_DevDataConfig_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TDEV_Device",
                columns: table => new
                {
                    C_Code = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_ProductCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_MachineCode = table.Column<string>(type: "varchar(255) CHARACTER SET utf8mb4", maxLength: 255, nullable: true),
                    C_Remark = table.Column<string>(type: "varchar(1024) CHARACTER SET utf8mb4", maxLength: 1024, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    I_Status = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TDEV_Device", x => x.C_Code);
                    table.ForeignKey(
                        name: "FK_TDEV_Device_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TDEV_Device_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TISP_Content",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_AlarmLevel = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_Status = table.Column<string>(type: "longtext CHARACTER SET utf8mb4", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TISP_Content", x => x.C_ID);
                    table.ForeignKey(
                        name: "FK_TISP_Content_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_Content_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TISP_ContentGroup",
                columns: table => new
                {
                    G_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    G_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    G_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false),
                    I_Type = table.Column<int>(type: "int", nullable: false),
                    C_PatrolItem = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TISP_ContentGroup", x => x.G_ID);
                    table.ForeignKey(
                        name: "FK_TISP_ContentGroup_TSYS_User_G_CreateBy",
                        column: x => x.G_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_ContentGroup_TSYS_User_G_LastUpdatedBy",
                        column: x => x.G_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TISP_Region",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_ImageUrl = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(50)", maxLength: 50, nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(50)", maxLength: 50, nullable: false),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TISP_Region", x => x.C_ID);
                    table.ForeignKey(
                        name: "FK_TISP_Region_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_Region_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TISP_Route",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_ImageUrl = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(50)", maxLength: 50, nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(50)", maxLength: 50, nullable: false),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TISP_Route", x => x.C_ID);
                    table.ForeignKey(
                        name: "FK_TISP_Route_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_Route_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TISP_Spot",
                columns: table => new
                {
                    C_Code = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Number = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Position = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: true),
                    C_QRCode = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: true),
                    C_GPS = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_ImageUrl = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: true),
                    I_Offset = table.Column<int>(type: "int", nullable: false),
                    C_CreateBy = table.Column<Guid>(type: "char(50)", maxLength: 50, nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(50)", maxLength: 50, nullable: false),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TISP_Spot", x => x.C_Code);
                    table.ForeignKey(
                        name: "FK_TISP_Spot_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_Spot_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TPNT_StoreOrg",
                columns: table => new
                {
                    C_StoreCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_OrgCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TPNT_StoreOrg", x => new { x.C_StoreCode, x.C_OrgCode });
                    table.ForeignKey(
                        name: "FK_TPNT_StoreOrg_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TPRD_ProdSKU",
                columns: table => new
                {
                    C_SKUCode = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: false),
                    C_TypeCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Name = table.Column<string>(type: "varchar(255) CHARACTER SET utf8mb4", maxLength: 255, nullable: false),
                    C_Spec = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: false),
                    C_Brand = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: false),
                    C_Vender = table.Column<string>(type: "varchar(255) CHARACTER SET utf8mb4", maxLength: 255, nullable: false),
                    C_ProdArea = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Unit = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_ImagePath = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: false),
                    C_IconPath = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: false),
                    I_MinStock = table.Column<int>(type: "int", nullable: false),
                    I_ValiDays = table.Column<int>(type: "int", nullable: false),
                    I_AlarmDays = table.Column<int>(type: "int", nullable: false),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TPRD_ProdSKU", x => x.C_SKUCode);
                    table.ForeignKey(
                        name: "FK_TPRD_ProdSKU_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TPRD_ProdSKU_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TPRD_Product",
                columns: table => new
                {
                    C_Code = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_QRCode = table.Column<string>(type: "varchar(255) CHARACTER SET utf8mb4", maxLength: 255, nullable: false),
                    C_SKUCode = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: false),
                    C_StoreCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_DeviceCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_SpotCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_AreaCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    F_Map_X = table.Column<decimal>(type: "decimal(12,2)", nullable: true),
                    F_Map_Y = table.Column<decimal>(type: "decimal(12,2)", nullable: true),
                    D_ProdDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    D_ValiDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    C_ImageUrl = table.Column<string>(type: "varchar(255) CHARACTER SET utf8mb4", maxLength: 255, nullable: false),
                    D_LastISP = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    I_IsAlarm = table.Column<int>(type: "int", nullable: false),
                    C_AlarmMsg = table.Column<string>(type: "varchar(1024) CHARACTER SET utf8mb4", maxLength: 1024, nullable: false),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(1024) CHARACTER SET utf8mb4", maxLength: 1024, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    I_Status = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TPRD_Product", x => x.C_Code);
                    table.ForeignKey(
                        name: "FK_TPRD_Product_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TPRD_Product_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TPRD_Type",
                columns: table => new
                {
                    C_Code = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    I_IfFPP = table.Column<int>(type: "int", nullable: false),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TPRD_Type", x => x.C_Code);
                    table.ForeignKey(
                        name: "FK_TPRD_Type_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TSEC_Record",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_SpotCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_SecurityContent = table.Column<string>(type: "longtext CHARACTER SET utf8mb4", nullable: true),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TSEC_Record", x => x.C_ID);
                    table.ForeignKey(
                        name: "FK_TSEC_Record_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TSEC_Record_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TSEC_RecordItem",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_RecordItemCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_SecurityContent = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TSEC_RecordItem", x => x.C_ID);
                    table.ForeignKey(
                        name: "FK_TSEC_RecordItem_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TSEC_RecordItem_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TSYS_LicenseType",
                columns: table => new
                {
                    C_Code = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Name = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: false),
                    I_MaxMemberQty = table.Column<int>(type: "int", nullable: false),
                    I_MaxStoreQty = table.Column<int>(type: "int", nullable: false),
                    I_MaxFileSize = table.Column<int>(type: "int", nullable: false),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TSYS_LicenseType", x => x.C_Code);
                    table.ForeignKey(
                        name: "FK_TSYS_LicenseType_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TSYS_LicenseType_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TSYS_Message",
                columns: table => new
                {
                    C_Code = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_LicenseCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Type = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Content = table.Column<string>(type: "varchar(1000) CHARACTER SET utf8mb4", maxLength: 1000, nullable: false),
                    C_UserID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_RelatedModule = table.Column<string>(type: "varchar(200) CHARACTER SET utf8mb4", maxLength: 200, nullable: true),
                    C_RelatedID = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TSYS_Message", x => x.C_Code);
                    table.ForeignKey(
                        name: "FK_TSYS_Message_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TSYS_Message_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TSYS_Message_TSYS_User_C_UserID",
                        column: x => x.C_UserID,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TSYS_Role",
                columns: table => new
                {
                    C_Code = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_LicenseCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
                    C_Description = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: true),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TSYS_Role", x => x.C_Code);
                    table.ForeignKey(
                        name: "FK_TSYS_Role_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TSYS_Role_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TSYS_Version",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_AppCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_VersionCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_UpdateContent = table.Column<string>(type: "varchar(1000) CHARACTER SET utf8mb4", maxLength: 1000, nullable: false),
                    C_DownloadURL = table.Column<string>(type: "varchar(1000) CHARACTER SET utf8mb4", maxLength: 1000, nullable: false),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TSYS_Version", x => x.C_ID);
                    table.ForeignKey(
                        name: "FK_TSYS_Version_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TSYS_Version_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TBDM_Area",
                columns: table => new
                {
                    C_Code = table.Column<string>(type: "varchar(20) CHARACTER SET utf8mb4", maxLength: 20, nullable: false),
                    C_CityCode = table.Column<string>(type: "varchar(20) CHARACTER SET utf8mb4", maxLength: 20, nullable: false),
                    C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TBDM_Area", x => x.C_Code);
                    table.ForeignKey(
                        name: "FK_TBDM_Area_TBDM_City_C_CityCode",
                        column: x => x.C_CityCode,
                        principalTable: "TBDM_City",
                        principalColumn: "C_Code",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TISP_ContentGroupItem",
                columns: table => new
                {
                    G_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    G_ContentGroupCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    G_ContentCode = table.Column<Guid>(type: "char(36)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TISP_ContentGroupItem", x => x.G_ID);
                    table.ForeignKey(
                        name: "FK_TISP_ContentGroupItem_TISP_Content_G_ContentCode",
                        column: x => x.G_ContentCode,
                        principalTable: "TISP_Content",
                        principalColumn: "C_ID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_ContentGroupItem_TISP_ContentGroup_G_ContentGroupCode",
                        column: x => x.G_ContentGroupCode,
                        principalTable: "TISP_ContentGroup",
                        principalColumn: "G_ID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TISP_Record",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_SpotCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TISP_Record", x => x.C_ID);
                    table.ForeignKey(
                        name: "FK_TISP_Record_TISP_Spot_C_SpotCode",
                        column: x => x.C_SpotCode,
                        principalTable: "TISP_Spot",
                        principalColumn: "C_Code",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_Record_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_Record_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TISP_SpotContent",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_ContentCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_SpotCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TISP_SpotContent", x => x.C_ID);
                    table.ForeignKey(
                        name: "FK_TISP_SpotContent_TISP_Content_C_ContentCode",
                        column: x => x.C_ContentCode,
                        principalTable: "TISP_Content",
                        principalColumn: "C_ID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_SpotContent_TISP_Spot_C_SpotCode",
                        column: x => x.C_SpotCode,
                        principalTable: "TISP_Spot",
                        principalColumn: "C_Code",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_SpotContent_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_SpotContent_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TISP_SpotRegion",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_RegionCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_SpotCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TISP_SpotRegion", x => x.C_ID);
                    table.ForeignKey(
                        name: "FK_TISP_SpotRegion_TISP_Region_C_RegionCode",
                        column: x => x.C_RegionCode,
                        principalTable: "TISP_Region",
                        principalColumn: "C_ID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_SpotRegion_TISP_Spot_C_SpotCode",
                        column: x => x.C_SpotCode,
                        principalTable: "TISP_Spot",
                        principalColumn: "C_Code",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_SpotRegion_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_SpotRegion_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TISP_SpotRoute",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_RouteCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_SpotCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TISP_SpotRoute", x => x.C_ID);
                    table.ForeignKey(
                        name: "FK_TISP_SpotRoute_TISP_Route_C_RouteCode",
                        column: x => x.C_RouteCode,
                        principalTable: "TISP_Route",
                        principalColumn: "C_ID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_SpotRoute_TISP_Spot_C_SpotCode",
                        column: x => x.C_SpotCode,
                        principalTable: "TISP_Spot",
                        principalColumn: "C_Code",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_SpotRoute_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_SpotRoute_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TISP_SpotUser",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_UserCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_SpotCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", maxLength: 1, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TISP_SpotUser", x => x.C_ID);
                    table.ForeignKey(
                        name: "FK_TISP_SpotUser_TISP_Spot_C_SpotCode",
                        column: x => x.C_SpotCode,
                        principalTable: "TISP_Spot",
                        principalColumn: "C_Code",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_SpotUser_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_SpotUser_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_SpotUser_TSYS_User_C_UserCode",
                        column: x => x.C_UserCode,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TSYS_Org",
                columns: table => new
                {
                    K_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    C_LicenseCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Code = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Name = table.Column<string>(type: "varchar(255) CHARACTER SET utf8mb4", maxLength: 255, nullable: false),
                    C_SName = table.Column<string>(type: "varchar(16) CHARACTER SET utf8mb4", maxLength: 16, nullable: true),
                    C_Lname = table.Column<string>(type: "longtext CHARACTER SET utf8mb4", maxLength: 2550, nullable: true),
                    C_Level = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: false),
                    C_ParentCode = table.Column<int>(type: "int", nullable: false),
                    C_Type = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Phone = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
                    C_Linker = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
                    C_GIS = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false),
                    StoreOrgC_StoreCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", nullable: true),
                    StoreOrgC_OrgCode = table.Column<Guid>(type: "char(36)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TSYS_Org", x => x.K_ID);
                    table.ForeignKey(
                        name: "FK_TSYS_Org_TPNT_StoreOrg_StoreOrgC_StoreCode_StoreOrgC_OrgCode",
                        columns: x => new { x.StoreOrgC_StoreCode, x.StoreOrgC_OrgCode },
                        principalTable: "TPNT_StoreOrg",
                        principalColumns: new[] { "C_StoreCode", "C_OrgCode" },
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TSYS_Org_TSYS_Org_C_ParentCode",
                        column: x => x.C_ParentCode,
                        principalTable: "TSYS_Org",
                        principalColumn: "K_ID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TSYS_Org_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TSYS_Org_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TSYS_License",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_TypeCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Code = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Name = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: false),
                    I_MemberQty = table.Column<int>(type: "int", nullable: false),
                    I_DiskCapacity = table.Column<int>(type: "int", nullable: false),
                    C_FilePath = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: false),
                    D_StartDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    D_EndDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TSYS_License", x => x.C_ID);
                    table.ForeignKey(
                        name: "FK_TSYS_License_TSYS_LicenseType_C_TypeCode",
                        column: x => x.C_TypeCode,
                        principalTable: "TSYS_LicenseType",
                        principalColumn: "C_Code",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TSYS_License_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TSYS_License_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TSYS_LicenseTypePriv",
                columns: table => new
                {
                    C_LicenseTypeCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_PrivilegeCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TSYS_LicenseTypePriv", x => new { x.C_LicenseTypeCode, x.C_PrivilegeCode });
                    table.ForeignKey(
                        name: "FK_TSYS_LicenseTypePriv_TSYS_LicenseType_C_LicenseTypeCode",
                        column: x => x.C_LicenseTypeCode,
                        principalTable: "TSYS_LicenseType",
                        principalColumn: "C_Code",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TSYS_LicenseTypePriv_TSYS_Priv_C_PrivilegeCode",
                        column: x => x.C_PrivilegeCode,
                        principalTable: "TSYS_Priv",
                        principalColumn: "C_Code",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TSYS_LicenseTypePriv_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TSYS_RolePriv",
                columns: table => new
                {
                    C_RoleCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_PrivilegeCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    I_Type = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TSYS_RolePriv", x => new { x.C_RoleCode, x.C_PrivilegeCode });
                    table.ForeignKey(
                        name: "FK_TSYS_RolePriv_TSYS_Role_C_RoleCode",
                        column: x => x.C_RoleCode,
                        principalTable: "TSYS_Role",
                        principalColumn: "C_Code",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TSYS_RolePriv_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TSYS_UserRole",
                columns: table => new
                {
                    C_UserCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_RoleCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TSYS_UserRole", x => new { x.C_UserCode, x.C_RoleCode });
                    table.ForeignKey(
                        name: "FK_TSYS_UserRole_TSYS_Role_C_RoleCode",
                        column: x => x.C_RoleCode,
                        principalTable: "TSYS_Role",
                        principalColumn: "C_Code",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TSYS_UserRole_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TSYS_UserRole_TSYS_User_C_UserCode",
                        column: x => x.C_UserCode,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TISP_RecordItem",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_ContentCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_RecordCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_InspectionContent = table.Column<string>(type: "longtext CHARACTER SET utf8mb4", nullable: true),
                    C_Remark = table.Column<string>(type: "longtext CHARACTER SET utf8mb4", nullable: true),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false),
                    C_CreateBy = table.Column<Guid>(type: "char(50)", maxLength: 50, nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(50)", maxLength: 50, nullable: false),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TISP_RecordItem", x => x.C_ID);
                    table.ForeignKey(
                        name: "FK_TISP_RecordItem_TISP_Content_C_ContentCode",
                        column: x => x.C_ContentCode,
                        principalTable: "TISP_Content",
                        principalColumn: "C_ID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_RecordItem_TISP_Record_C_RecordCode",
                        column: x => x.C_RecordCode,
                        principalTable: "TISP_Record",
                        principalColumn: "C_ID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_RecordItem_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TISP_RecordItem_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TPNT_Store",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_LicenseCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_AreaCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
                    C_Code = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
                    C_Name = table.Column<string>(type: "varchar(255) CHARACTER SET utf8mb4", maxLength: 255, nullable: false),
                    C_SName = table.Column<string>(type: "varchar(16) CHARACTER SET utf8mb4", maxLength: 16, nullable: true),
                    C_TypeCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Address = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
                    C_GPS = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: true),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(500) CHARACTER SET utf8mb4", maxLength: 500, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false),
                    LicenseC_ID = table.Column<Guid>(type: "char(36)", nullable: true),
                    StoreOrgC_StoreCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", nullable: true),
                    StoreOrgC_OrgCode = table.Column<Guid>(type: "char(36)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TPNT_Store", x => x.C_ID);
                    table.ForeignKey(
                        name: "FK_TPNT_Store_TBDM_Area_C_AreaCode",
                        column: x => x.C_AreaCode,
                        principalTable: "TBDM_Area",
                        principalColumn: "C_Code",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TPNT_Store_TPNT_StoreOrg_StoreOrgC_StoreCode_StoreOrgC_OrgCo~",
                        columns: x => new { x.StoreOrgC_StoreCode, x.StoreOrgC_OrgCode },
                        principalTable: "TPNT_StoreOrg",
                        principalColumns: new[] { "C_StoreCode", "C_OrgCode" },
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TPNT_Store_TPNT_Type_C_TypeCode",
                        column: x => x.C_TypeCode,
                        principalTable: "TPNT_Type",
                        principalColumn: "C_Code",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TPNT_Store_TSYS_License_LicenseC_ID",
                        column: x => x.LicenseC_ID,
                        principalTable: "TSYS_License",
                        principalColumn: "C_ID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TPNT_Store_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TPNT_Store_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TISP_RecordImage",
                columns: table => new
                {
                    C_ID = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_RecordItemCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_ImageURL = table.Column<string>(type: "varchar(200) CHARACTER SET utf8mb4", maxLength: 200, nullable: false),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TISP_RecordImage", x => x.C_ID);
                    table.ForeignKey(
                        name: "FK_TISP_RecordImage_TISP_RecordItem_C_RecordItemCode",
                        column: x => x.C_RecordItemCode,
                        principalTable: "TISP_RecordItem",
                        principalColumn: "C_ID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TPNT_Area",
                columns: table => new
                {
                    C_Code = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_StoreCode = table.Column<Guid>(type: "char(36)", nullable: false),
                    C_Name = table.Column<string>(type: "varchar(255) CHARACTER SET utf8mb4", maxLength: 255, nullable: false),
                    C_SName = table.Column<string>(type: "varchar(16) CHARACTER SET utf8mb4", maxLength: 16, nullable: true),
                    C_ImageUrl = table.Column<string>(type: "varchar(255) CHARACTER SET utf8mb4", maxLength: 255, nullable: true),
                    I_Sort = table.Column<int>(type: "int", nullable: false),
                    C_Remark = table.Column<string>(type: "varchar(1024) CHARACTER SET utf8mb4", maxLength: 1024, nullable: true),
                    C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
                    D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
                    D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    C_Status = table.Column<string>(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TPNT_Area", x => x.C_Code);
                    table.ForeignKey(
                        name: "FK_TPNT_Area_TPNT_Store_C_StoreCode",
                        column: x => x.C_StoreCode,
                        principalTable: "TPNT_Store",
                        principalColumn: "C_ID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TPNT_Area_TSYS_User_C_CreateBy",
                        column: x => x.C_CreateBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_TPNT_Area_TSYS_User_C_LastUpdatedBy",
                        column: x => x.C_LastUpdatedBy,
                        principalTable: "TSYS_User",
                        principalColumn: "C_UserID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateIndex(
                name: "IX_TaskInfoDto_TasksQzId",
                table: "TaskInfoDto",
                column: "TasksQzId");

            migrationBuilder.CreateIndex(
                name: "IX_TBDM_Area_C_CityCode",
                table: "TBDM_Area",
                column: "C_CityCode");

            migrationBuilder.CreateIndex(
                name: "IX_TBDM_City_C_ProvCode",
                table: "TBDM_City",
                column: "C_ProvCode");

            migrationBuilder.CreateIndex(
                name: "IX_TBDM_CodeDetail_C_CreateBy",
                table: "TBDM_CodeDetail",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TBDM_CodeDetail_C_LastUpdatedBy",
                table: "TBDM_CodeDetail",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TBDM_CodeMain_C_CreateBy",
                table: "TBDM_CodeMain",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TBDM_CodeMain_C_LastUpdatedBy",
                table: "TBDM_CodeMain",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TDEV_DevAlertConfig_C_CreateBy",
                table: "TDEV_DevAlertConfig",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TDEV_DevAlertConfig_C_LastUpdatedBy",
                table: "TDEV_DevAlertConfig",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TDEV_DevDataConfig_C_CreateBy",
                table: "TDEV_DevDataConfig",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TDEV_DevDataConfig_C_LastUpdatedBy",
                table: "TDEV_DevDataConfig",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TDEV_Device_C_CreateBy",
                table: "TDEV_Device",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TDEV_Device_C_LastUpdatedBy",
                table: "TDEV_Device",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_Content_C_CreateBy",
                table: "TISP_Content",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_Content_C_LastUpdatedBy",
                table: "TISP_Content",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_ContentGroup_G_CreateBy",
                table: "TISP_ContentGroup",
                column: "G_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_ContentGroup_G_LastUpdatedBy",
                table: "TISP_ContentGroup",
                column: "G_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_ContentGroupItem_G_ContentCode",
                table: "TISP_ContentGroupItem",
                column: "G_ContentCode");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_ContentGroupItem_G_ContentGroupCode",
                table: "TISP_ContentGroupItem",
                column: "G_ContentGroupCode");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_Record_C_CreateBy",
                table: "TISP_Record",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_Record_C_LastUpdatedBy",
                table: "TISP_Record",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_Record_C_SpotCode",
                table: "TISP_Record",
                column: "C_SpotCode");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_RecordImage_C_RecordItemCode",
                table: "TISP_RecordImage",
                column: "C_RecordItemCode");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_RecordItem_C_ContentCode",
                table: "TISP_RecordItem",
                column: "C_ContentCode");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_RecordItem_C_CreateBy",
                table: "TISP_RecordItem",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_RecordItem_C_LastUpdatedBy",
                table: "TISP_RecordItem",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_RecordItem_C_RecordCode",
                table: "TISP_RecordItem",
                column: "C_RecordCode");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_Region_C_CreateBy",
                table: "TISP_Region",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_Region_C_LastUpdatedBy",
                table: "TISP_Region",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_Route_C_CreateBy",
                table: "TISP_Route",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_Route_C_LastUpdatedBy",
                table: "TISP_Route",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_Spot_C_CreateBy",
                table: "TISP_Spot",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_Spot_C_LastUpdatedBy",
                table: "TISP_Spot",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_SpotContent_C_ContentCode",
                table: "TISP_SpotContent",
                column: "C_ContentCode");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_SpotContent_C_CreateBy",
                table: "TISP_SpotContent",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_SpotContent_C_LastUpdatedBy",
                table: "TISP_SpotContent",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_SpotContent_C_SpotCode",
                table: "TISP_SpotContent",
                column: "C_SpotCode");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_SpotRegion_C_CreateBy",
                table: "TISP_SpotRegion",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_SpotRegion_C_LastUpdatedBy",
                table: "TISP_SpotRegion",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_SpotRegion_C_RegionCode",
                table: "TISP_SpotRegion",
                column: "C_RegionCode");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_SpotRegion_C_SpotCode",
                table: "TISP_SpotRegion",
                column: "C_SpotCode");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_SpotRoute_C_CreateBy",
                table: "TISP_SpotRoute",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_SpotRoute_C_LastUpdatedBy",
                table: "TISP_SpotRoute",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_SpotRoute_C_RouteCode",
                table: "TISP_SpotRoute",
                column: "C_RouteCode");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_SpotRoute_C_SpotCode",
                table: "TISP_SpotRoute",
                column: "C_SpotCode");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_SpotUser_C_CreateBy",
                table: "TISP_SpotUser",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_SpotUser_C_LastUpdatedBy",
                table: "TISP_SpotUser",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_SpotUser_C_SpotCode",
                table: "TISP_SpotUser",
                column: "C_SpotCode");

            migrationBuilder.CreateIndex(
                name: "IX_TISP_SpotUser_C_UserCode",
                table: "TISP_SpotUser",
                column: "C_UserCode");

            migrationBuilder.CreateIndex(
                name: "IX_TPNT_Area_C_CreateBy",
                table: "TPNT_Area",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TPNT_Area_C_LastUpdatedBy",
                table: "TPNT_Area",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TPNT_Area_C_StoreCode",
                table: "TPNT_Area",
                column: "C_StoreCode");

            migrationBuilder.CreateIndex(
                name: "IX_TPNT_Store_C_AreaCode",
                table: "TPNT_Store",
                column: "C_AreaCode");

            migrationBuilder.CreateIndex(
                name: "IX_TPNT_Store_C_Code",
                table: "TPNT_Store",
                column: "C_Code",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_TPNT_Store_C_CreateBy",
                table: "TPNT_Store",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TPNT_Store_C_LastUpdatedBy",
                table: "TPNT_Store",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TPNT_Store_C_TypeCode",
                table: "TPNT_Store",
                column: "C_TypeCode");

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

            migrationBuilder.CreateIndex(
                name: "IX_TPNT_Store_StoreOrgC_StoreCode_StoreOrgC_OrgCode",
                table: "TPNT_Store",
                columns: new[] { "StoreOrgC_StoreCode", "StoreOrgC_OrgCode" });

            migrationBuilder.CreateIndex(
                name: "IX_TPNT_StoreOrg_C_CreateBy",
                table: "TPNT_StoreOrg",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TPRD_ProdSKU_C_CreateBy",
                table: "TPRD_ProdSKU",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TPRD_ProdSKU_C_LastUpdatedBy",
                table: "TPRD_ProdSKU",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TPRD_Product_C_CreateBy",
                table: "TPRD_Product",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TPRD_Product_C_LastUpdatedBy",
                table: "TPRD_Product",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TPRD_Type_C_CreateBy",
                table: "TPRD_Type",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSEC_Record_C_CreateBy",
                table: "TSEC_Record",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSEC_Record_C_LastUpdatedBy",
                table: "TSEC_Record",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSEC_RecordItem_C_CreateBy",
                table: "TSEC_RecordItem",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSEC_RecordItem_C_LastUpdatedBy",
                table: "TSEC_RecordItem",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_License_C_Code",
                table: "TSYS_License",
                column: "C_Code",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_License_C_CreateBy",
                table: "TSYS_License",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_License_C_LastUpdatedBy",
                table: "TSYS_License",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_License_C_TypeCode",
                table: "TSYS_License",
                column: "C_TypeCode");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_LicenseType_C_CreateBy",
                table: "TSYS_LicenseType",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_LicenseType_C_LastUpdatedBy",
                table: "TSYS_LicenseType",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_LicenseTypePriv_C_CreateBy",
                table: "TSYS_LicenseTypePriv",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_LicenseTypePriv_C_PrivilegeCode",
                table: "TSYS_LicenseTypePriv",
                column: "C_PrivilegeCode");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_Message_C_CreateBy",
                table: "TSYS_Message",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_Message_C_LastUpdatedBy",
                table: "TSYS_Message",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_Message_C_UserID",
                table: "TSYS_Message",
                column: "C_UserID");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_Org_C_CreateBy",
                table: "TSYS_Org",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_Org_C_LastUpdatedBy",
                table: "TSYS_Org",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_Org_C_ParentCode",
                table: "TSYS_Org",
                column: "C_ParentCode");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_Org_StoreOrgC_StoreCode_StoreOrgC_OrgCode",
                table: "TSYS_Org",
                columns: new[] { "StoreOrgC_StoreCode", "StoreOrgC_OrgCode" });

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_Priv_C_ParentCode",
                table: "TSYS_Priv",
                column: "C_ParentCode");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_Role_C_CreateBy",
                table: "TSYS_Role",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_Role_C_LastUpdatedBy",
                table: "TSYS_Role",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_RolePriv_C_CreateBy",
                table: "TSYS_RolePriv",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_User_C_CreateBy",
                table: "TSYS_User",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_User_C_IDNum",
                table: "TSYS_User",
                column: "C_IDNum",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_User_C_LastUpdatedBy",
                table: "TSYS_User",
                column: "C_LastUpdatedBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_User_C_Mobile",
                table: "TSYS_User",
                column: "C_Mobile",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_UserRole_C_CreateBy",
                table: "TSYS_UserRole",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_UserRole_C_RoleCode",
                table: "TSYS_UserRole",
                column: "C_RoleCode");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_Version_C_CreateBy",
                table: "TSYS_Version",
                column: "C_CreateBy");

            migrationBuilder.CreateIndex(
                name: "IX_TSYS_Version_C_LastUpdatedBy",
                table: "TSYS_Version",
                column: "C_LastUpdatedBy");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Report");

            migrationBuilder.DropTable(
                name: "TaskInfoDto");

            migrationBuilder.DropTable(
                name: "TBDM_CodeDetail");

            migrationBuilder.DropTable(
                name: "TBDM_CodeMain");

            migrationBuilder.DropTable(
                name: "TDEV_DevAlert");

            migrationBuilder.DropTable(
                name: "TDEV_DevAlertConfig");

            migrationBuilder.DropTable(
                name: "TDEV_DevData");

            migrationBuilder.DropTable(
                name: "TDEV_DevDataConfig");

            migrationBuilder.DropTable(
                name: "TDEV_Device");

            migrationBuilder.DropTable(
                name: "TISP_ContentGroupItem");

            migrationBuilder.DropTable(
                name: "TISP_RecordAlarm");

            migrationBuilder.DropTable(
                name: "TISP_RecordImage");

            migrationBuilder.DropTable(
                name: "TISP_SpotContent");

            migrationBuilder.DropTable(
                name: "TISP_SpotRegion");

            migrationBuilder.DropTable(
                name: "TISP_SpotRoute");

            migrationBuilder.DropTable(
                name: "TISP_SpotUser");

            migrationBuilder.DropTable(
                name: "TPNT_Area");

            migrationBuilder.DropTable(
                name: "TPRD_Log");

            migrationBuilder.DropTable(
                name: "TPRD_ProdSKU");

            migrationBuilder.DropTable(
                name: "TPRD_Product");

            migrationBuilder.DropTable(
                name: "TPRD_Type");

            migrationBuilder.DropTable(
                name: "TSEC_Record");

            migrationBuilder.DropTable(
                name: "TSEC_RecordImage");

            migrationBuilder.DropTable(
                name: "TSEC_RecordItem");

            migrationBuilder.DropTable(
                name: "TSYS_LicenseTypePriv");

            migrationBuilder.DropTable(
                name: "TSYS_Message");

            migrationBuilder.DropTable(
                name: "TSYS_Org");

            migrationBuilder.DropTable(
                name: "TSYS_Organize");

            migrationBuilder.DropTable(
                name: "TSYS_Post");

            migrationBuilder.DropTable(
                name: "TSYS_RolePriv");

            migrationBuilder.DropTable(
                name: "TSYS_UserPost");

            migrationBuilder.DropTable(
                name: "TSYS_UserRole");

            migrationBuilder.DropTable(
                name: "TSYS_Version");

            migrationBuilder.DropTable(
                name: "TasksQz");

            migrationBuilder.DropTable(
                name: "TISP_ContentGroup");

            migrationBuilder.DropTable(
                name: "TISP_RecordItem");

            migrationBuilder.DropTable(
                name: "TISP_Region");

            migrationBuilder.DropTable(
                name: "TISP_Route");

            migrationBuilder.DropTable(
                name: "TPNT_Store");

            migrationBuilder.DropTable(
                name: "TSYS_Priv");

            migrationBuilder.DropTable(
                name: "TSYS_Role");

            migrationBuilder.DropTable(
                name: "TISP_Content");

            migrationBuilder.DropTable(
                name: "TISP_Record");

            migrationBuilder.DropTable(
                name: "TBDM_Area");

            migrationBuilder.DropTable(
                name: "TPNT_StoreOrg");

            migrationBuilder.DropTable(
                name: "TPNT_Type");

            migrationBuilder.DropTable(
                name: "TSYS_License");

            migrationBuilder.DropTable(
                name: "TISP_Spot");

            migrationBuilder.DropTable(
                name: "TBDM_City");

            migrationBuilder.DropTable(
                name: "TSYS_LicenseType");

            migrationBuilder.DropTable(
                name: "TBDM_Prov");

            migrationBuilder.DropTable(
                name: "TSYS_User");
        }
    }
}