ComputerHardwareStore_YouAr.../ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/Migrations/20240501142223_cs2.cs

60 lines
1.7 KiB
C#
Raw Permalink Normal View History

2024-05-01 18:38:59 +04:00
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");
}
}
}