using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace wtmProject.DataAccess.Migrations { public partial class hmr2024032802 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "WTM_VISIT_PLAN", columns: table => new { ID = table.Column(type: "uniqueidentifier", nullable: false), CustomId = table.Column(type: "uniqueidentifier", nullable: true), AreaId = table.Column(type: "uniqueidentifier", nullable: true), VisitObjectId = table.Column(type: "uniqueidentifier", nullable: true), VisitStartTime = table.Column(type: "datetime2", nullable: true), VisitEndTime = table.Column(type: "datetime2", nullable: true), VisitTarget = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), MarkManageId = 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_VISIT_PLAN", x => x.ID); table.ForeignKey( name: "FK_WTM_VISIT_PLAN_FrameworkUsers_MarkManageId", column: x => x.MarkManageId, principalTable: "FrameworkUsers", principalColumn: "ID"); table.ForeignKey( name: "FK_WTM_VISIT_PLAN_WTM_AREA_AreaId", column: x => x.AreaId, principalTable: "WTM_AREA", principalColumn: "ID"); table.ForeignKey( name: "FK_WTM_VISIT_PLAN_WTM_CUSTOM_CustomId", column: x => x.CustomId, principalTable: "WTM_CUSTOM", principalColumn: "ID"); table.ForeignKey( name: "FK_WTM_VISIT_PLAN_WTM_CUSTOM_PERSON_VisitObjectId", column: x => x.VisitObjectId, principalTable: "WTM_CUSTOM_PERSON", principalColumn: "ID"); }); migrationBuilder.CreateTable( name: "WTM_VISIT_PLAN_USER", columns: table => new { ID = table.Column(type: "uniqueidentifier", nullable: false), VisitPlanId = table.Column(type: "uniqueidentifier", nullable: true), UserId = 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_VISIT_PLAN_USER", x => x.ID); table.ForeignKey( name: "FK_WTM_VISIT_PLAN_USER_FrameworkUsers_UserId", column: x => x.UserId, principalTable: "FrameworkUsers", principalColumn: "ID"); table.ForeignKey( name: "FK_WTM_VISIT_PLAN_USER_WTM_VISIT_PLAN_VisitPlanId", column: x => x.VisitPlanId, principalTable: "WTM_VISIT_PLAN", principalColumn: "ID", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_WTM_VISIT_PLAN_AreaId", table: "WTM_VISIT_PLAN", column: "AreaId"); migrationBuilder.CreateIndex( name: "IX_WTM_VISIT_PLAN_CustomId", table: "WTM_VISIT_PLAN", column: "CustomId"); migrationBuilder.CreateIndex( name: "IX_WTM_VISIT_PLAN_MarkManageId", table: "WTM_VISIT_PLAN", column: "MarkManageId"); migrationBuilder.CreateIndex( name: "IX_WTM_VISIT_PLAN_VisitObjectId", table: "WTM_VISIT_PLAN", column: "VisitObjectId"); migrationBuilder.CreateIndex( name: "IX_WTM_VISIT_PLAN_USER_UserId", table: "WTM_VISIT_PLAN_USER", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_WTM_VISIT_PLAN_USER_VisitPlanId", table: "WTM_VISIT_PLAN_USER", column: "VisitPlanId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "WTM_VISIT_PLAN_USER"); migrationBuilder.DropTable( name: "WTM_VISIT_PLAN"); } } }