mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-10-03 19:03:22 +00:00
170 lines
6 KiB
C#
170 lines
6 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Data.SeaHavenIndustries.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class SH101_UpliftApprovalWorkflow : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_DispatchUpliftRequests_DispatchId_Status",
|
|
table: "DispatchUpliftRequests");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Purpose",
|
|
table: "VendorCompletionDocuments",
|
|
type: "nvarchar(30)",
|
|
maxLength: 30,
|
|
nullable: false,
|
|
defaultValue: "Completion");
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "EscalatedAt",
|
|
table: "DispatchUpliftRequests",
|
|
type: "datetime2",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "EvidenceDocumentId",
|
|
table: "DispatchUpliftRequests",
|
|
type: "int",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "ExpiresAt",
|
|
table: "DispatchUpliftRequests",
|
|
type: "datetime2",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "InitialNotificationSentAt",
|
|
table: "DispatchUpliftRequests",
|
|
type: "datetime2",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "NotificationError",
|
|
table: "DispatchUpliftRequests",
|
|
type: "nvarchar(500)",
|
|
maxLength: 500,
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "NotificationStatus",
|
|
table: "DispatchUpliftRequests",
|
|
type: "nvarchar(20)",
|
|
maxLength: 20,
|
|
nullable: false,
|
|
defaultValue: "Pending");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "RequestKey",
|
|
table: "DispatchUpliftRequests",
|
|
type: "nvarchar(100)",
|
|
maxLength: 100,
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<byte[]>(
|
|
name: "RowVersion",
|
|
table: "DispatchUpliftRequests",
|
|
type: "rowversion",
|
|
rowVersion: true,
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DispatchUpliftRequests_DispatchId",
|
|
table: "DispatchUpliftRequests",
|
|
column: "DispatchId",
|
|
unique: true,
|
|
filter: "[Status] IN ('Pending', 'ChangesRequested')");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DispatchUpliftRequests_DispatchId_RequestKey",
|
|
table: "DispatchUpliftRequests",
|
|
columns: new[] { "DispatchId", "RequestKey" },
|
|
unique: true,
|
|
filter: "[RequestKey] IS NOT NULL");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DispatchUpliftRequests_EvidenceDocumentId",
|
|
table: "DispatchUpliftRequests",
|
|
column: "EvidenceDocumentId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_DispatchUpliftRequests_VendorCompletionDocuments_EvidenceDocumentId",
|
|
table: "DispatchUpliftRequests",
|
|
column: "EvidenceDocumentId",
|
|
principalTable: "VendorCompletionDocuments",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_DispatchUpliftRequests_VendorCompletionDocuments_EvidenceDocumentId",
|
|
table: "DispatchUpliftRequests");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_DispatchUpliftRequests_DispatchId",
|
|
table: "DispatchUpliftRequests");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_DispatchUpliftRequests_DispatchId_RequestKey",
|
|
table: "DispatchUpliftRequests");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_DispatchUpliftRequests_EvidenceDocumentId",
|
|
table: "DispatchUpliftRequests");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Purpose",
|
|
table: "VendorCompletionDocuments");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "EscalatedAt",
|
|
table: "DispatchUpliftRequests");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "EvidenceDocumentId",
|
|
table: "DispatchUpliftRequests");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ExpiresAt",
|
|
table: "DispatchUpliftRequests");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "InitialNotificationSentAt",
|
|
table: "DispatchUpliftRequests");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "NotificationError",
|
|
table: "DispatchUpliftRequests");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "NotificationStatus",
|
|
table: "DispatchUpliftRequests");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "RequestKey",
|
|
table: "DispatchUpliftRequests");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "RowVersion",
|
|
table: "DispatchUpliftRequests");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DispatchUpliftRequests_DispatchId_Status",
|
|
table: "DispatchUpliftRequests",
|
|
columns: new[] { "DispatchId", "Status" },
|
|
unique: true,
|
|
filter: "[Status] = 'Pending'");
|
|
}
|
|
}
|
|
}
|