using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Back.Migrations { /// public partial class Promotion : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Promotions", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Name = table.Column(type: "nvarchar(max)", nullable: false), Satus = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Promotions", x => x.ID); }); migrationBuilder.CreateTable( name: "PromotionDetails", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), PromotionID = table.Column(type: "int", nullable: false), PermissionID = table.Column(type: "int", nullable: false), CreditAmount = table.Column(type: "int", nullable: false), APrice = table.Column(type: "decimal(18,2)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_PromotionDetails", x => x.ID); table.ForeignKey( name: "FK_PromotionDetails_Permissions_PermissionID", column: x => x.PermissionID, principalTable: "Permissions", principalColumn: "ID", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_PromotionDetails_Promotions_PromotionID", column: x => x.PromotionID, principalTable: "Promotions", principalColumn: "ID", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_PromotionDetails_PermissionID", table: "PromotionDetails", column: "PermissionID"); migrationBuilder.CreateIndex( name: "IX_PromotionDetails_PromotionID", table: "PromotionDetails", column: "PromotionID"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "PromotionDetails"); migrationBuilder.DropTable( name: "Promotions"); } } }