using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace wtmProject.DataAccess.Migrations { public partial class hmr2024032601 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "WTM_AREA", columns: table => new { ID = table.Column(type: "uniqueidentifier", nullable: false), AreaCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), AreaName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), 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_AREA", x => x.ID); }); migrationBuilder.CreateTable( name: "WTM_PROJECT", columns: table => new { ID = table.Column(type: "uniqueidentifier", nullable: false), ProjectCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), ProjectName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), 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_PROJECT", x => x.ID); }); migrationBuilder.CreateTable( name: "WTM_USER", columns: table => new { ID = table.Column(type: "uniqueidentifier", nullable: false), Code = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), Gender = table.Column(type: "int", nullable: true), Password = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: false), IsValid = table.Column(type: "bit", nullable: false), PhotoId = table.Column(type: "uniqueidentifier", nullable: true), CellPhone = table.Column(type: "nvarchar(max)", nullable: true), TenantCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), DepartmentId = table.Column(type: "uniqueidentifier", 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_USER", x => x.ID); table.ForeignKey( name: "FK_WTM_USER_FileAttachments_PhotoId", column: x => x.PhotoId, principalTable: "FileAttachments", principalColumn: "ID", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_WTM_USER_FrameworkGroups_DepartmentId", column: x => x.DepartmentId, principalTable: "FrameworkGroups", principalColumn: "ID"); }); migrationBuilder.CreateTable( name: "WTM_USER_AREA", columns: table => new { ID = table.Column(type: "uniqueidentifier", nullable: false), UserCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), AreaCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), 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_USER_AREA", x => x.ID); }); migrationBuilder.CreateTable( name: "WTM_USER_PROJECT", columns: table => new { ID = table.Column(type: "uniqueidentifier", nullable: false), UserCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), ProjectCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), 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_USER_PROJECT", x => x.ID); }); migrationBuilder.CreateIndex( name: "IX_WTM_USER_DepartmentId", table: "WTM_USER", column: "DepartmentId"); migrationBuilder.CreateIndex( name: "IX_WTM_USER_PhotoId", table: "WTM_USER", column: "PhotoId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "WTM_AREA"); migrationBuilder.DropTable( name: "WTM_PROJECT"); migrationBuilder.DropTable( name: "WTM_USER"); migrationBuilder.DropTable( name: "WTM_USER_AREA"); migrationBuilder.DropTable( name: "WTM_USER_PROJECT"); } } }