using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace CMSMicroservice.Infrastructure.Persistence.Migrations { /// public partial class u07 : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Contracts", schema: "CMS", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Title = table.Column(type: "nvarchar(max)", nullable: false), Description = table.Column(type: "nvarchar(max)", nullable: false), HtmlContent = table.Column(type: "nvarchar(max)", nullable: false), Type = table.Column(type: "int", nullable: false), Created = table.Column(type: "datetime2", nullable: false), CreatedBy = table.Column(type: "nvarchar(max)", nullable: true), LastModified = table.Column(type: "datetime2", nullable: true), LastModifiedBy = table.Column(type: "nvarchar(max)", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Contracts", x => x.Id); }); migrationBuilder.CreateTable( name: "UserContracts", schema: "CMS", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), UserId = table.Column(type: "bigint", nullable: false), ContractId = table.Column(type: "bigint", nullable: false), SignGuid = table.Column(type: "nvarchar(max)", nullable: false), SignedPdfFile = table.Column(type: "nvarchar(max)", nullable: false), Created = table.Column(type: "datetime2", nullable: false), CreatedBy = table.Column(type: "nvarchar(max)", nullable: true), LastModified = table.Column(type: "datetime2", nullable: true), LastModifiedBy = table.Column(type: "nvarchar(max)", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_UserContracts", x => x.Id); table.ForeignKey( name: "FK_UserContracts_Contracts_ContractId", column: x => x.ContractId, principalSchema: "CMS", principalTable: "Contracts", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_UserContracts_Users_UserId", column: x => x.UserId, principalSchema: "CMS", principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_UserContracts_ContractId", schema: "CMS", table: "UserContracts", column: "ContractId"); migrationBuilder.CreateIndex( name: "IX_UserContracts_UserId", schema: "CMS", table: "UserContracts", column: "UserId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "UserContracts", schema: "CMS"); migrationBuilder.DropTable( name: "Contracts", schema: "CMS"); } } }