78 lines
2.5 KiB
C#
78 lines
2.5 KiB
C#
|
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);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|