using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Casestudy.Migrations { /// <inheritdoc /> public partial class first : Migration { /// <inheritdoc /> protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Brands", columns: table => new { Id = table.Column<int>(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Name = table.Column<string>(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Brands", x => x.Id); }); migrationBuilder.CreateTable( name: "Products", columns: table => new { Id = table.Column<string>(type: "nvarchar(450)", nullable: false), BrandId = table.Column<int>(type: "int", nullable: false), ProductName = table.Column<string>(type: "nvarchar(max)", nullable: false), GraphicName = table.Column<string>(type: "nvarchar(max)", nullable: false), CostPrice = table.Column<decimal>(type: "money", nullable: false), MSRP = table.Column<decimal>(type: "money", nullable: false), QtyOnHand = table.Column<int>(type: "int", nullable: false), QtyOnBackOrder = table.Column<int>(type: "int", nullable: false), Description = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true) }, constraints: table => { table.PrimaryKey("PK_Products", x => x.Id); table.ForeignKey( name: "FK_Products_Brands_BrandId", column: x => x.BrandId, principalTable: "Brands", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Products_BrandId", table: "Products", column: "BrandId"); } /// <inheritdoc /> protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Products"); migrationBuilder.DropTable( name: "Brands"); } } }