77 lines
3.1 KiB
C#
77 lines
3.1 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using NodaTime;
|
|
|
|
#nullable disable
|
|
|
|
namespace FictionArchive.Service.NovelService.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddNovelImportSaga : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "ActiveImports",
|
|
columns: table => new
|
|
{
|
|
ImportId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
NovelUrl = table.Column<string>(type: "text", nullable: false),
|
|
StartedAt = table.Column<Instant>(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<Guid>(type: "uuid", nullable: false),
|
|
CurrentState = table.Column<string>(type: "text", nullable: false),
|
|
NovelUrl = table.Column<string>(type: "text", nullable: false),
|
|
NovelId = table.Column<long>(type: "bigint", nullable: true),
|
|
ExpectedChapters = table.Column<int>(type: "integer", nullable: false),
|
|
CompletedChapters = table.Column<int>(type: "integer", nullable: false),
|
|
ExpectedImages = table.Column<int>(type: "integer", nullable: false),
|
|
CompletedImages = table.Column<int>(type: "integer", nullable: false),
|
|
StartedAt = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
|
CompletedAt = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
|
|
ErrorMessage = table.Column<string>(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");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "ActiveImports");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "NovelImportSagaStates");
|
|
}
|
|
}
|
|
}
|