using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.SeaHavenIndustries.Migrations
{
///
public partial class MultiWODispatch : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn(
name: "WorkOrderId",
table: "Dispatches",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AddColumn(
name: "AcceptToken",
table: "Dispatches",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn(
name: "AcknowledgedAt",
table: "Dispatches",
type: "datetime2",
nullable: true);
migrationBuilder.CreateTable(
name: "DispatchWorkOrders",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DispatchId = table.Column(type: "int", nullable: false),
WorkOrderId = table.Column(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DispatchWorkOrders", x => x.Id);
table.ForeignKey(
name: "FK_DispatchWorkOrders_Dispatches_DispatchId",
column: x => x.DispatchId,
principalTable: "Dispatches",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_DispatchWorkOrders_workOrders_WorkOrderId",
column: x => x.WorkOrderId,
principalTable: "workOrders",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_DispatchWorkOrders_DispatchId",
table: "DispatchWorkOrders",
column: "DispatchId");
migrationBuilder.CreateIndex(
name: "IX_DispatchWorkOrders_WorkOrderId",
table: "DispatchWorkOrders",
column: "WorkOrderId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DispatchWorkOrders");
migrationBuilder.DropColumn(
name: "AcceptToken",
table: "Dispatches");
migrationBuilder.DropColumn(
name: "AcknowledgedAt",
table: "Dispatches");
migrationBuilder.AlterColumn(
name: "WorkOrderId",
table: "Dispatches",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
}
}
}