60 lines
1.8 KiB
C#
60 lines
1.8 KiB
C#
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
|
|||
|
#nullable disable
|
|||
|
|
|||
|
namespace ConfectioneryDatabaseImplement.Migrations
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
public partial class migr3 : Migration
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "FK_Orders_Clients_ClientId",
|
|||
|
table: "Orders");
|
|||
|
|
|||
|
migrationBuilder.AlterColumn<int>(
|
|||
|
name: "ClientId",
|
|||
|
table: "Orders",
|
|||
|
type: "integer",
|
|||
|
nullable: false,
|
|||
|
defaultValue: 0,
|
|||
|
oldClrType: typeof(int),
|
|||
|
oldType: "integer",
|
|||
|
oldNullable: true);
|
|||
|
|
|||
|
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.AlterColumn<int>(
|
|||
|
name: "ClientId",
|
|||
|
table: "Orders",
|
|||
|
type: "integer",
|
|||
|
nullable: true,
|
|||
|
oldClrType: typeof(int),
|
|||
|
oldType: "integer");
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "FK_Orders_Clients_ClientId",
|
|||
|
table: "Orders",
|
|||
|
column: "ClientId",
|
|||
|
principalTable: "Clients",
|
|||
|
principalColumn: "Id");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|