using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ScadaLink.ConfigurationDatabase.Migrations { /// public partial class AddNotificationsTable : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "Type", table: "NotificationLists", type: "nvarchar(32)", maxLength: 32, nullable: false, defaultValue: "Email"); migrationBuilder.CreateTable( name: "Notifications", columns: table => new { NotificationId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), Type = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: false), ListName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), Subject = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: false), Body = table.Column(type: "nvarchar(max)", nullable: false), TypeData = table.Column(type: "nvarchar(max)", nullable: true), Status = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: false), RetryCount = table.Column(type: "int", nullable: false), LastError = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: true), ResolvedTargets = table.Column(type: "nvarchar(max)", nullable: true), SourceSiteId = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), SourceInstanceId = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), SourceScript = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), SiteEnqueuedAt = table.Column(type: "datetimeoffset", nullable: false), CreatedAt = table.Column(type: "datetimeoffset", nullable: false), LastAttemptAt = table.Column(type: "datetimeoffset", nullable: true), NextAttemptAt = table.Column(type: "datetimeoffset", nullable: true), DeliveredAt = table.Column(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" }); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Notifications"); migrationBuilder.DropColumn( name: "Type", table: "NotificationLists"); } } }