[FA-misc] Add initial ReportingService migration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-01-30 16:43:48 -05:00
parent 1fda5ad440
commit 1057e1bcd4
3 changed files with 223 additions and 0 deletions

View File

@@ -0,0 +1,86 @@
// <auto-generated />
using System;
using System.Collections.Generic;
using FictionArchive.Service.ReportingService.Services;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using NodaTime;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace FictionArchive.Service.ReportingService.Migrations
{
[DbContext(typeof(ReportingDbContext))]
[Migration("20260130214338_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("FictionArchive.Service.ReportingService.Models.Job", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Instant>("CreatedTime")
.HasColumnType("timestamp with time zone");
b.Property<string>("DisplayName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ErrorMessage")
.HasColumnType("text");
b.Property<string>("JobType")
.IsRequired()
.HasColumnType("text");
b.Property<Instant>("LastUpdatedTime")
.HasColumnType("timestamp with time zone");
b.Property<Dictionary<string, string>>("Metadata")
.HasColumnType("jsonb");
b.Property<Guid?>("ParentJobId")
.HasColumnType("uuid");
b.Property<int>("Status")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ParentJobId");
b.ToTable("Jobs");
});
modelBuilder.Entity("FictionArchive.Service.ReportingService.Models.Job", b =>
{
b.HasOne("FictionArchive.Service.ReportingService.Models.Job", "ParentJob")
.WithMany("ChildJobs")
.HasForeignKey("ParentJobId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("ParentJob");
});
modelBuilder.Entity("FictionArchive.Service.ReportingService.Models.Job", b =>
{
b.Navigation("ChildJobs");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace FictionArchive.Service.ReportingService.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Jobs",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ParentJobId = table.Column<Guid>(type: "uuid", nullable: true),
JobType = table.Column<string>(type: "text", nullable: false),
DisplayName = table.Column<string>(type: "text", nullable: false),
Status = table.Column<int>(type: "integer", nullable: false),
ErrorMessage = table.Column<string>(type: "text", nullable: true),
Metadata = table.Column<Dictionary<string, string>>(type: "jsonb", nullable: true),
CreatedTime = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
LastUpdatedTime = table.Column<Instant>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Jobs", x => x.Id);
table.ForeignKey(
name: "FK_Jobs_Jobs_ParentJobId",
column: x => x.ParentJobId,
principalTable: "Jobs",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateIndex(
name: "IX_Jobs_ParentJobId",
table: "Jobs",
column: "ParentJobId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Jobs");
}
}
}

View File

@@ -0,0 +1,83 @@
// <auto-generated />
using System;
using System.Collections.Generic;
using FictionArchive.Service.ReportingService.Services;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using NodaTime;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace FictionArchive.Service.ReportingService.Migrations
{
[DbContext(typeof(ReportingDbContext))]
partial class ReportingDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("FictionArchive.Service.ReportingService.Models.Job", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Instant>("CreatedTime")
.HasColumnType("timestamp with time zone");
b.Property<string>("DisplayName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ErrorMessage")
.HasColumnType("text");
b.Property<string>("JobType")
.IsRequired()
.HasColumnType("text");
b.Property<Instant>("LastUpdatedTime")
.HasColumnType("timestamp with time zone");
b.Property<Dictionary<string, string>>("Metadata")
.HasColumnType("jsonb");
b.Property<Guid?>("ParentJobId")
.HasColumnType("uuid");
b.Property<int>("Status")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ParentJobId");
b.ToTable("Jobs");
});
modelBuilder.Entity("FictionArchive.Service.ReportingService.Models.Job", b =>
{
b.HasOne("FictionArchive.Service.ReportingService.Models.Job", "ParentJob")
.WithMany("ChildJobs")
.HasForeignKey("ParentJobId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("ParentJob");
});
modelBuilder.Entity("FictionArchive.Service.ReportingService.Models.Job", b =>
{
b.Navigation("ChildJobs");
});
#pragma warning restore 612, 618
}
}
}