shoc-backend/Data.SeaHavenIndustries/Migrations/20260724234953_SH133_WorkOrderWebhookIngestion.cs
2026-07-24 21:03:50 -03:00

67 lines
2.4 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.SeaHavenIndustries.Migrations
{
/// <inheritdoc />
public partial class SH133_WorkOrderWebhookIngestion : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTimeOffset>(
name: "ExternalLastOccurredAt",
table: "workOrders",
type: "datetimeoffset",
nullable: true);
migrationBuilder.CreateTable(
name: "WorkOrderWebhookDeliveries",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DeliveryId = table.Column<string>(
type: "nvarchar(128)",
maxLength: 128,
nullable: false),
EventType = table.Column<string>(
type: "nvarchar(64)",
maxLength: 64,
nullable: false),
OccurredAt = table.Column<DateTimeOffset>(
type: "datetimeoffset",
nullable: false),
ProcessedAt = table.Column<DateTimeOffset>(
type: "datetimeoffset",
nullable: false),
BodySha256 = table.Column<string>(
type: "nvarchar(64)",
maxLength: 64,
nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_WorkOrderWebhookDeliveries", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_WorkOrderWebhookDeliveries_DeliveryId",
table: "WorkOrderWebhookDeliveries",
column: "DeliveryId",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "WorkOrderWebhookDeliveries");
migrationBuilder.DropColumn(
name: "ExternalLastOccurredAt",
table: "workOrders");
}
}
}