using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace bitforum.Migrations.DefaultDb { /// public partial class AddPopupTable : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropIndex( name: "IX_Document_IsActive", table: "Document"); migrationBuilder.CreateTable( name: "Popup", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Subject = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: false), Content = table.Column(type: "nvarchar(max)", nullable: true), Link = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: false), StartAt = table.Column(type: "datetime2", nullable: true), EndAt = table.Column(type: "datetime2", nullable: true), Order = table.Column(type: "int", nullable: false), IsActive = table.Column(type: "bit", nullable: false), Views = table.Column(type: "int", nullable: false), UpdatedAt = table.Column(type: "datetime2", nullable: true), CreatedAt = table.Column(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Popup", x => x.ID); }); migrationBuilder.CreateIndex( name: "IX_Document_IsActive", table: "Document", column: "IsActive"); migrationBuilder.CreateIndex( name: "IX_Popup_IsActive", table: "Popup", column: "IsActive"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Popup"); migrationBuilder.DropIndex( name: "IX_Document_IsActive", table: "Document"); migrationBuilder.CreateIndex( name: "IX_Document_IsActive", table: "Document", column: "IsActive", unique: true); } } }