51 lines
1.4 KiB
C#
51 lines
1.4 KiB
C#
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
|
|||
|
#nullable disable
|
|||
|
|
|||
|
namespace FurnitureAssemblyDatabaseImplement.Migrations
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
public partial class lab52 : Migration
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.AddColumn<int>(
|
|||
|
name: "ClientId",
|
|||
|
table: "Orders",
|
|||
|
type: "int",
|
|||
|
nullable: false,
|
|||
|
defaultValue: 0);
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_Orders_ClientId",
|
|||
|
table: "Orders",
|
|||
|
column: "ClientId");
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "FK_Orders_Clients_ClientId",
|
|||
|
table: "Orders",
|
|||
|
column: "ClientId",
|
|||
|
principalTable: "Clients",
|
|||
|
principalColumn: "Id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
}
|
|||
|
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "FK_Orders_Clients_ClientId",
|
|||
|
table: "Orders");
|
|||
|
|
|||
|
migrationBuilder.DropIndex(
|
|||
|
name: "IX_Orders_ClientId",
|
|||
|
table: "Orders");
|
|||
|
|
|||
|
migrationBuilder.DropColumn(
|
|||
|
name: "ClientId",
|
|||
|
table: "Orders");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|