using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace wtmProject.DataAccess.Migrations { public partial class hmr2024032801 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "WTM_CUSTOM", columns: table => new { ID = table.Column(type: "uniqueidentifier", nullable: false), CustomAllName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), CustomShortName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), ParentUnit = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), AreaId = table.Column(type: "uniqueidentifier", nullable: true), TenantCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), CreateTime = table.Column(type: "datetime2", nullable: true), CreateBy = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), UpdateTime = table.Column(type: "datetime2", nullable: true), UpdateBy = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true) }, constraints: table => { table.PrimaryKey("PK_WTM_CUSTOM", x => x.ID); table.ForeignKey( name: "FK_WTM_CUSTOM_WTM_AREA_AreaId", column: x => x.AreaId, principalTable: "WTM_AREA", principalColumn: "ID"); }); migrationBuilder.CreateTable( name: "WTM_CUSTOM_PERSON", columns: table => new { ID = table.Column(type: "uniqueidentifier", nullable: false), CustomId = table.Column(type: "uniqueidentifier", nullable: true), PersonName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), PersonPhone = table.Column(type: "nvarchar(max)", nullable: true), PersonPost = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), TenantCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), CreateTime = table.Column(type: "datetime2", nullable: true), CreateBy = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), UpdateTime = table.Column(type: "datetime2", nullable: true), UpdateBy = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true) }, constraints: table => { table.PrimaryKey("PK_WTM_CUSTOM_PERSON", x => x.ID); table.ForeignKey( name: "FK_WTM_CUSTOM_PERSON_WTM_CUSTOM_CustomId", column: x => x.CustomId, principalTable: "WTM_CUSTOM", principalColumn: "ID", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_WTM_CUSTOM_AreaId", table: "WTM_CUSTOM", column: "AreaId"); migrationBuilder.CreateIndex( name: "IX_WTM_CUSTOM_PERSON_CustomId", table: "WTM_CUSTOM_PERSON", column: "CustomId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "WTM_CUSTOM_PERSON"); migrationBuilder.DropTable( name: "WTM_CUSTOM"); } } }