SUBD_PIbd-23_ZakharovRA/CarShowroom/CarShowroomDatabaseStorage/Migrations/20240512174258_changeCarsAndSale.cs

78 lines
2.5 KiB
C#
Raw Normal View History

2024-05-12 21:44:49 +04:00
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CarShowroomDatabaseStorage.Migrations
{
/// <inheritdoc />
public partial class changeCarsAndSale : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_sale_car_sale_sale_id",
table: "sale_car");
migrationBuilder.DropForeignKey(
name: "FK_sale_service_sale_sale_id",
table: "sale_service");
migrationBuilder.AddColumn<bool>(
name: "car_issaled",
table: "car",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddForeignKey(
name: "FK_sale_car_sale_sale_id",
table: "sale_car",
column: "sale_id",
principalTable: "sale",
principalColumn: "sale_id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_sale_service_sale_sale_id",
table: "sale_service",
column: "sale_id",
principalTable: "sale",
principalColumn: "sale_id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_sale_car_sale_sale_id",
table: "sale_car");
migrationBuilder.DropForeignKey(
name: "FK_sale_service_sale_sale_id",
table: "sale_service");
migrationBuilder.DropColumn(
name: "car_issaled",
table: "car");
migrationBuilder.AddForeignKey(
name: "FK_sale_car_sale_sale_id",
table: "sale_car",
column: "sale_id",
principalTable: "sale",
principalColumn: "sale_id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_sale_service_sale_sale_id",
table: "sale_service",
column: "sale_id",
principalTable: "sale",
principalColumn: "sale_id",
onDelete: ReferentialAction.Restrict);
}
}
}