From 1057e1bcd422d9952d3c8bebd9aed0f68a5e359e Mon Sep 17 00:00:00 2001 From: gamer147 Date: Fri, 30 Jan 2026 16:43:48 -0500 Subject: [PATCH] [FA-misc] Add initial ReportingService migration Co-Authored-By: Claude Opus 4.5 --- .../20260130214338_InitialCreate.Designer.cs | 86 +++++++++++++++++++ .../20260130214338_InitialCreate.cs | 54 ++++++++++++ .../ReportingDbContextModelSnapshot.cs | 83 ++++++++++++++++++ 3 files changed, 223 insertions(+) create mode 100644 FictionArchive.Service.ReportingService/Migrations/20260130214338_InitialCreate.Designer.cs create mode 100644 FictionArchive.Service.ReportingService/Migrations/20260130214338_InitialCreate.cs create mode 100644 FictionArchive.Service.ReportingService/Migrations/ReportingDbContextModelSnapshot.cs diff --git a/FictionArchive.Service.ReportingService/Migrations/20260130214338_InitialCreate.Designer.cs b/FictionArchive.Service.ReportingService/Migrations/20260130214338_InitialCreate.Designer.cs new file mode 100644 index 0000000..3e548e0 --- /dev/null +++ b/FictionArchive.Service.ReportingService/Migrations/20260130214338_InitialCreate.Designer.cs @@ -0,0 +1,86 @@ +// +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 + { + /// + 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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedTime") + .HasColumnType("timestamp with time zone"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnType("text"); + + b.Property("ErrorMessage") + .HasColumnType("text"); + + b.Property("JobType") + .IsRequired() + .HasColumnType("text"); + + b.Property("LastUpdatedTime") + .HasColumnType("timestamp with time zone"); + + b.Property>("Metadata") + .HasColumnType("jsonb"); + + b.Property("ParentJobId") + .HasColumnType("uuid"); + + b.Property("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 + } + } +} diff --git a/FictionArchive.Service.ReportingService/Migrations/20260130214338_InitialCreate.cs b/FictionArchive.Service.ReportingService/Migrations/20260130214338_InitialCreate.cs new file mode 100644 index 0000000..262bde0 --- /dev/null +++ b/FictionArchive.Service.ReportingService/Migrations/20260130214338_InitialCreate.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; +using NodaTime; + +#nullable disable + +namespace FictionArchive.Service.ReportingService.Migrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Jobs", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + ParentJobId = table.Column(type: "uuid", nullable: true), + JobType = table.Column(type: "text", nullable: false), + DisplayName = table.Column(type: "text", nullable: false), + Status = table.Column(type: "integer", nullable: false), + ErrorMessage = table.Column(type: "text", nullable: true), + Metadata = table.Column>(type: "jsonb", nullable: true), + CreatedTime = table.Column(type: "timestamp with time zone", nullable: false), + LastUpdatedTime = table.Column(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"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Jobs"); + } + } +} diff --git a/FictionArchive.Service.ReportingService/Migrations/ReportingDbContextModelSnapshot.cs b/FictionArchive.Service.ReportingService/Migrations/ReportingDbContextModelSnapshot.cs new file mode 100644 index 0000000..7b6a936 --- /dev/null +++ b/FictionArchive.Service.ReportingService/Migrations/ReportingDbContextModelSnapshot.cs @@ -0,0 +1,83 @@ +// +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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedTime") + .HasColumnType("timestamp with time zone"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnType("text"); + + b.Property("ErrorMessage") + .HasColumnType("text"); + + b.Property("JobType") + .IsRequired() + .HasColumnType("text"); + + b.Property("LastUpdatedTime") + .HasColumnType("timestamp with time zone"); + + b.Property>("Metadata") + .HasColumnType("jsonb"); + + b.Property("ParentJobId") + .HasColumnType("uuid"); + + b.Property("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 + } + } +}