60 lines
1.7 KiB
C#
60 lines
1.7 KiB
C#
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
|
|||
|
#nullable disable
|
|||
|
|
|||
|
namespace ComputerHardwareStoreDatabaseImplement.Migrations
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
public partial class cs2 : Migration
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.AddColumn<int>(
|
|||
|
name: "Count",
|
|||
|
table: "Orders",
|
|||
|
type: "integer",
|
|||
|
nullable: false,
|
|||
|
defaultValue: 0);
|
|||
|
|
|||
|
migrationBuilder.AddColumn<int>(
|
|||
|
name: "ProductId",
|
|||
|
table: "Orders",
|
|||
|
type: "integer",
|
|||
|
nullable: true);
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_Orders_ProductId",
|
|||
|
table: "Orders",
|
|||
|
column: "ProductId");
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "FK_Orders_Products_ProductId",
|
|||
|
table: "Orders",
|
|||
|
column: "ProductId",
|
|||
|
principalTable: "Products",
|
|||
|
principalColumn: "Id");
|
|||
|
}
|
|||
|
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "FK_Orders_Products_ProductId",
|
|||
|
table: "Orders");
|
|||
|
|
|||
|
migrationBuilder.DropIndex(
|
|||
|
name: "IX_Orders_ProductId",
|
|||
|
table: "Orders");
|
|||
|
|
|||
|
migrationBuilder.DropColumn(
|
|||
|
name: "Count",
|
|||
|
table: "Orders");
|
|||
|
|
|||
|
migrationBuilder.DropColumn(
|
|||
|
name: "ProductId",
|
|||
|
table: "Orders");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|