ComputerHardwareStore_YouAr.../ComputerHardwareStore/ComputerHardwareStoreDatabaseImplement/Migrations/20240501130816_fix.cs

81 lines
2.4 KiB
C#
Raw Permalink Normal View History

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ComputerHardwareStoreDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class fix : Migration
{
/// <inheritdoc />
protected override void Up(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");
migrationBuilder.CreateIndex(
name: "IX_Comments_BuildId",
table: "Comments",
column: "BuildId");
migrationBuilder.AddForeignKey(
name: "FK_Comments_Builds_BuildId",
table: "Comments",
column: "BuildId",
principalTable: "Builds",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Comments_Builds_BuildId",
table: "Comments");
migrationBuilder.DropIndex(
name: "IX_Comments_BuildId",
table: "Comments");
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");
}
}
}