using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.SeaHavenIndustries.Migrations
{
///
public partial class AddDispatchUpliftRequest : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "DispatchUpliftRequests",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DispatchId = table.Column(type: "int", nullable: false),
CurrentNTE = table.Column(type: "decimal(18,2)", nullable: true),
RequestedNTE = table.Column(type: "decimal(18,2)", nullable: false),
VendorReason = table.Column(type: "nvarchar(max)", nullable: true),
Status = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false),
RequiredTier = table.Column(type: "int", nullable: false),
RequestedByVendorName = table.Column(type: "nvarchar(max)", nullable: true),
DecidedAt = table.Column(type: "datetime2", nullable: true),
DecidedByUserId = table.Column(type: "nvarchar(max)", nullable: true),
DecisionNote = table.Column(type: "nvarchar(max)", nullable: true),
IsDeleted = table.Column(type: "bit", nullable: true),
createdby = table.Column(type: "nvarchar(max)", nullable: true),
DeleterUserId = table.Column(type: "nvarchar(max)", nullable: true),
DeletionTime = table.Column(type: "datetime2", nullable: true),
CreatedDate = table.Column(type: "datetime2", nullable: true),
LastModificationTime = table.Column(type: "datetime2", nullable: true),
LastModifierUserId = table.Column(type: "int", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_DispatchUpliftRequests", x => x.Id);
table.ForeignKey(
name: "FK_DispatchUpliftRequests_Dispatches_DispatchId",
column: x => x.DispatchId,
principalTable: "Dispatches",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_DispatchUpliftRequests_DispatchId_Status",
table: "DispatchUpliftRequests",
columns: new[] { "DispatchId", "Status" },
unique: true,
filter: "[Status] = 'Pending'");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DispatchUpliftRequests");
}
}
}