73 lines
3.5 KiB
C#
73 lines
3.5 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace ScadaLink.ConfigurationDatabase.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddNotificationsTable : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Type",
|
|
table: "NotificationLists",
|
|
type: "nvarchar(32)",
|
|
maxLength: 32,
|
|
nullable: false,
|
|
defaultValue: "Email");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Notifications",
|
|
columns: table => new
|
|
{
|
|
NotificationId = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
|
|
Type = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
|
|
ListName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
|
|
Subject = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: false),
|
|
Body = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
TypeData = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Status = table.Column<string>(type: "nvarchar(32)", maxLength: 32, nullable: false),
|
|
RetryCount = table.Column<int>(type: "int", nullable: false),
|
|
LastError = table.Column<string>(type: "nvarchar(4000)", maxLength: 4000, nullable: true),
|
|
ResolvedTargets = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
SourceSiteId = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
|
SourceInstanceId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
|
|
SourceScript = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
|
|
SiteEnqueuedAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
|
|
CreatedAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false),
|
|
LastAttemptAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
|
NextAttemptAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
|
DeliveredAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Notifications", x => x.NotificationId);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Notifications_SourceSiteId_CreatedAt",
|
|
table: "Notifications",
|
|
columns: new[] { "SourceSiteId", "CreatedAt" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Notifications_Status_NextAttemptAt",
|
|
table: "Notifications",
|
|
columns: new[] { "Status", "NextAttemptAt" });
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Notifications");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Type",
|
|
table: "NotificationLists");
|
|
}
|
|
}
|
|
}
|