using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace FlexJobApi.Database.Migrations.Migrations { /// public partial class AddContractTemplate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "ContractTemplate", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), EnterpriseId = table.Column(type: "uniqueidentifier", nullable: false), Name = table.Column(type: "nvarchar(max)", nullable: false), File = table.Column(type: "nvarchar(max)", nullable: false), Code = table.Column(type: "nvarchar(max)", nullable: true), Access = table.Column(type: "int", nullable: true), TemplateId = table.Column(type: "nvarchar(max)", nullable: true), Status = table.Column(type: "int", nullable: false), CompletedTime = table.Column(type: "datetime2", nullable: true), IsDisabled = table.Column(type: "bit", nullable: false), CreatedTime = table.Column(type: "datetimeoffset", nullable: false), UpdatedTime = table.Column(type: "datetimeoffset", nullable: true), Sort = table.Column(type: "int", nullable: false), TraceId = table.Column(type: "nvarchar(max)", nullable: true), CreatedUserId = table.Column(type: "uniqueidentifier", nullable: true), CreatedEnterpriseId = table.Column(type: "uniqueidentifier", nullable: true), UpdatedUserId = table.Column(type: "uniqueidentifier", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ContractTemplate", x => x.Id); table.ForeignKey( name: "FK_ContractTemplate_Enterprise_EnterpriseId", column: x => x.EnterpriseId, principalTable: "Enterprise", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "ContractTemplateValue", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), TemplateId = table.Column(type: "uniqueidentifier", nullable: false), Type = table.Column(type: "int", nullable: false), Recorder = table.Column(type: "int", nullable: false), UserType = table.Column(type: "int", nullable: true), Label = table.Column(type: "nvarchar(max)", nullable: true), Name = table.Column(type: "nvarchar(max)", nullable: true), Required = table.Column(type: "bit", nullable: false), CreatedTime = table.Column(type: "datetimeoffset", nullable: false), UpdatedTime = table.Column(type: "datetimeoffset", nullable: true), Sort = table.Column(type: "int", nullable: false), TraceId = table.Column(type: "nvarchar(max)", nullable: true), CreatedUserId = table.Column(type: "uniqueidentifier", nullable: true), CreatedEnterpriseId = table.Column(type: "uniqueidentifier", nullable: true), UpdatedUserId = table.Column(type: "uniqueidentifier", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ContractTemplateValue", x => x.Id); table.ForeignKey( name: "FK_ContractTemplateValue_ContractTemplate_TemplateId", column: x => x.TemplateId, principalTable: "ContractTemplate", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_ContractTemplate_EnterpriseId", table: "ContractTemplate", column: "EnterpriseId"); migrationBuilder.CreateIndex( name: "IX_ContractTemplateValue_TemplateId", table: "ContractTemplateValue", column: "TemplateId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ContractTemplateValue"); migrationBuilder.DropTable( name: "ContractTemplate"); } } }