using System; using Microsoft.EntityFrameworkCore.Migrations; using NodaTime; #nullable disable namespace FictionArchive.Service.NovelService.Migrations { /// public partial class AddNovelImportSaga : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "ActiveImports", columns: table => new { ImportId = table.Column(type: "uuid", nullable: false), NovelUrl = table.Column(type: "text", nullable: false), StartedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ActiveImports", x => x.ImportId); }); migrationBuilder.CreateTable( name: "NovelImportSagaStates", columns: table => new { CorrelationId = table.Column(type: "uuid", nullable: false), CurrentState = table.Column(type: "text", nullable: false), NovelUrl = table.Column(type: "text", nullable: false), NovelId = table.Column(type: "bigint", nullable: true), ExpectedChapters = table.Column(type: "integer", nullable: false), CompletedChapters = table.Column(type: "integer", nullable: false), ExpectedImages = table.Column(type: "integer", nullable: false), CompletedImages = table.Column(type: "integer", nullable: false), StartedAt = table.Column(type: "timestamp with time zone", nullable: false), CompletedAt = table.Column(type: "timestamp with time zone", nullable: true), ErrorMessage = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_NovelImportSagaStates", x => x.CorrelationId); }); migrationBuilder.CreateIndex( name: "IX_ActiveImports_NovelUrl", table: "ActiveImports", column: "NovelUrl", unique: true); migrationBuilder.CreateIndex( name: "IX_NovelImportSagaStates_CurrentState", table: "NovelImportSagaStates", column: "CurrentState"); migrationBuilder.CreateIndex( name: "IX_NovelImportSagaStates_NovelUrl", table: "NovelImportSagaStates", column: "NovelUrl"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ActiveImports"); migrationBuilder.DropTable( name: "NovelImportSagaStates"); } } }