123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- namespace Ropin.Inspection.Model.Migrations
- {
- public partial class EditBDM : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- 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: "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: "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_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.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");
- }
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "TBDM_Area");
- migrationBuilder.DropTable(
- name: "TBDM_CodeDetail");
- migrationBuilder.DropTable(
- name: "TBDM_CodeMain");
- migrationBuilder.DropTable(
- name: "TBDM_City");
- migrationBuilder.DropTable(
- name: "TBDM_Prov");
- }
- }
- }
|