using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ComputerShopDatabaseImplement.Migrations { /// public partial class component2 : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "OrderComponents", columns: table => new { Id = table.Column(nullable: false) .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), OrderId = table.Column(nullable: false), ComponentId = table.Column(nullable: false), Count = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_OrderComponents", x => x.Id); table.ForeignKey( name: "FK_OrderComponents_Orders_OrderId", column: x => x.OrderId, principalTable: "Orders", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_OrderComponents_Components_ComponentId", column: x => x.ComponentId, principalTable: "Components", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "OrderComponents"); } } }