mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-10-03 22:33:19 +00:00
97 lines
3.3 KiB
C#
97 lines
3.3 KiB
C#
|
|
using System;
|
|||
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
|
|
|||
|
|
#nullable disable
|
|||
|
|
|
|||
|
|
namespace Data.SeaHavenIndustries.Migrations
|
|||
|
|
{
|
|||
|
|
/// <inheritdoc />
|
|||
|
|
public partial class MultiWODispatch : Migration
|
|||
|
|
{
|
|||
|
|
/// <inheritdoc />
|
|||
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
|
{
|
|||
|
|
migrationBuilder.AlterColumn<int>(
|
|||
|
|
name: "WorkOrderId",
|
|||
|
|
table: "Dispatches",
|
|||
|
|
type: "int",
|
|||
|
|
nullable: true,
|
|||
|
|
oldClrType: typeof(int),
|
|||
|
|
oldType: "int");
|
|||
|
|
|
|||
|
|
migrationBuilder.AddColumn<string>(
|
|||
|
|
name: "AcceptToken",
|
|||
|
|
table: "Dispatches",
|
|||
|
|
type: "nvarchar(max)",
|
|||
|
|
nullable: true);
|
|||
|
|
|
|||
|
|
migrationBuilder.AddColumn<DateTime>(
|
|||
|
|
name: "AcknowledgedAt",
|
|||
|
|
table: "Dispatches",
|
|||
|
|
type: "datetime2",
|
|||
|
|
nullable: true);
|
|||
|
|
|
|||
|
|
migrationBuilder.CreateTable(
|
|||
|
|
name: "DispatchWorkOrders",
|
|||
|
|
columns: table => new
|
|||
|
|
{
|
|||
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|||
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|||
|
|
DispatchId = table.Column<int>(type: "int", nullable: false),
|
|||
|
|
WorkOrderId = table.Column<int>(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");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <inheritdoc />
|
|||
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
|
{
|
|||
|
|
migrationBuilder.DropTable(
|
|||
|
|
name: "DispatchWorkOrders");
|
|||
|
|
|
|||
|
|
migrationBuilder.DropColumn(
|
|||
|
|
name: "AcceptToken",
|
|||
|
|
table: "Dispatches");
|
|||
|
|
|
|||
|
|
migrationBuilder.DropColumn(
|
|||
|
|
name: "AcknowledgedAt",
|
|||
|
|
table: "Dispatches");
|
|||
|
|
|
|||
|
|
migrationBuilder.AlterColumn<int>(
|
|||
|
|
name: "WorkOrderId",
|
|||
|
|
table: "Dispatches",
|
|||
|
|
type: "int",
|
|||
|
|
nullable: false,
|
|||
|
|
defaultValue: 0,
|
|||
|
|
oldClrType: typeof(int),
|
|||
|
|
oldType: "int",
|
|||
|
|
oldNullable: true);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|