// using System; using API.Schema; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace API.Migrations { [DbContext(typeof(PgsqlContext))] [Migration("20241201235443_Initial")] partial class Initial { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "9.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("API.Schema.Author", b => { b.Property("AuthorId") .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("AuthorName") .IsRequired() .HasColumnType("text"); b.HasKey("AuthorId"); b.ToTable("Authors"); }); modelBuilder.Entity("API.Schema.Chapter", b => { b.Property("ChapterId") .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("ArchiveFileName") .IsRequired() .HasColumnType("text"); b.Property("ChapterIds") .IsRequired() .HasColumnType("text"); b.Property("ChapterNumber") .HasColumnType("real"); b.Property("Downloaded") .HasColumnType("boolean"); b.Property("ParentMangaId") .IsRequired() .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("Title") .HasColumnType("text"); b.Property("Url") .IsRequired() .HasColumnType("text"); b.Property("VolumeNumber") .HasColumnType("real"); b.HasKey("ChapterId"); b.HasIndex("ParentMangaId"); b.ToTable("Chapters"); }); modelBuilder.Entity("API.Schema.Jobs.Job", b => { b.Property("JobId") .HasMaxLength(64) .HasColumnType("character varying(64)"); b.PrimitiveCollection("DependsOnJobIds") .HasMaxLength(64) .HasColumnType("text[]"); b.Property("JobId1") .HasColumnType("character varying(64)"); b.Property("JobType") .HasColumnType("smallint"); b.Property("LastExecution") .HasColumnType("timestamp with time zone"); b.Property("NextExecution") .HasColumnType("timestamp with time zone"); b.Property("ParentJobId") .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("RecurrenceMs") .HasColumnType("numeric(20,0)"); b.Property("state") .HasColumnType("integer"); b.HasKey("JobId"); b.HasIndex("JobId1"); b.ToTable("Jobs"); b.HasDiscriminator("JobType"); b.UseTphMappingStrategy(); }); modelBuilder.Entity("API.Schema.LibraryConnectors.LibraryConnector", b => { b.Property("LibraryConnectorId") .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("Auth") .IsRequired() .HasColumnType("text"); b.Property("BaseUrl") .IsRequired() .HasColumnType("text"); b.Property("LibraryType") .HasColumnType("smallint"); b.HasKey("LibraryConnectorId"); b.ToTable("LibraryConnectors"); b.HasDiscriminator("LibraryType"); b.UseTphMappingStrategy(); }); modelBuilder.Entity("API.Schema.Link", b => { b.Property("LinkId") .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("LinkIds") .HasColumnType("text"); b.Property("LinkProvider") .IsRequired() .HasColumnType("text"); b.Property("LinkUrl") .IsRequired() .HasColumnType("text"); b.Property("MangaId") .IsRequired() .HasColumnType("character varying(64)"); b.HasKey("LinkId"); b.HasIndex("MangaId"); b.ToTable("Link"); }); modelBuilder.Entity("API.Schema.Manga", b => { b.Property("MangaId") .HasMaxLength(64) .HasColumnType("character varying(64)"); b.PrimitiveCollection("AltTitleIds") .IsRequired() .HasColumnType("text[]"); b.PrimitiveCollection("AuthorIds") .IsRequired() .HasColumnType("text[]"); b.Property("ConnectorId") .IsRequired() .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("CoverFileNameInCache") .HasColumnType("text"); b.Property("CoverUrl") .IsRequired() .HasColumnType("text"); b.Property("Description") .IsRequired() .HasColumnType("text"); b.Property("FolderName") .IsRequired() .HasColumnType("text"); b.Property("IgnoreChapterBefore") .HasColumnType("real"); b.Property("LatestChapterAvailableId") .HasColumnType("character varying(64)"); b.Property("LatestChapterDownloadedId") .HasColumnType("character varying(64)"); b.PrimitiveCollection("LinkIds") .IsRequired() .HasColumnType("text[]"); b.Property("MangaConnectorName") .IsRequired() .HasColumnType("character varying(32)"); b.Property("MangaIds") .IsRequired() .HasColumnType("text"); b.Property("Name") .IsRequired() .HasColumnType("text"); b.Property("OriginalLanguage") .HasColumnType("text"); b.Property("ReleaseStatus") .HasColumnType("smallint"); b.PrimitiveCollection("TagIds") .IsRequired() .HasColumnType("text[]"); b.Property("year") .HasColumnType("bigint"); b.HasKey("MangaId"); b.HasIndex("LatestChapterAvailableId") .IsUnique(); b.HasIndex("LatestChapterDownloadedId") .IsUnique(); b.HasIndex("MangaConnectorName"); b.ToTable("Manga"); }); modelBuilder.Entity("API.Schema.MangaAltTitle", b => { b.Property("AltTitleId") .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("AltTitleIds") .HasColumnType("text"); b.Property("Language") .IsRequired() .HasMaxLength(8) .HasColumnType("character varying(8)"); b.Property("MangaId") .IsRequired() .HasColumnType("character varying(64)"); b.Property("Title") .IsRequired() .HasColumnType("text"); b.HasKey("AltTitleId"); b.HasIndex("MangaId"); b.ToTable("AltTitles"); }); modelBuilder.Entity("API.Schema.MangaConnector", b => { b.Property("Name") .HasMaxLength(32) .HasColumnType("character varying(32)"); b.PrimitiveCollection("BaseUris") .IsRequired() .HasColumnType("text[]"); b.PrimitiveCollection("SupportedLanguages") .IsRequired() .HasColumnType("text[]"); b.HasKey("Name"); b.ToTable("MangaConnectors"); }); modelBuilder.Entity("API.Schema.MangaTag", b => { b.Property("Tag") .HasColumnType("text"); b.HasKey("Tag"); b.ToTable("Tags"); }); modelBuilder.Entity("API.Schema.NotificationConnectors.NotificationConnector", b => { b.Property("NotificationConnectorId") .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("NotificationConnectorType") .HasColumnType("smallint"); b.HasKey("NotificationConnectorId"); b.ToTable("NotificationConnectors"); b.HasDiscriminator("NotificationConnectorType"); b.UseTphMappingStrategy(); }); modelBuilder.Entity("MangaAuthor", b => { b.Property("MangaId") .HasColumnType("character varying(64)"); b.Property("AuthorId") .HasColumnType("character varying(64)"); b.Property("AuthorIds") .HasColumnType("text"); b.Property("MangaIds") .HasColumnType("text"); b.HasKey("MangaId", "AuthorId"); b.HasIndex("AuthorId"); b.ToTable("MangaAuthor"); }); modelBuilder.Entity("MangaTag", b => { b.Property("MangaId") .HasColumnType("character varying(64)"); b.Property("Tag") .HasColumnType("text"); b.Property("MangaIds") .IsRequired() .HasColumnType("text"); b.Property("TagIds") .HasColumnType("text"); b.HasKey("MangaId", "Tag"); b.HasIndex("MangaIds"); b.HasIndex("Tag"); b.ToTable("MangaTag"); }); modelBuilder.Entity("API.Schema.Jobs.CreateArchiveJob", b => { b.HasBaseType("API.Schema.Jobs.Job"); b.Property("ChapterId") .IsRequired() .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("ComicInfoLocation") .IsRequired() .HasColumnType("text"); b.Property("ImagesLocation") .IsRequired() .HasColumnType("text"); b.HasIndex("ChapterId"); b.ToTable("Jobs", t => { t.Property("ChapterId") .HasColumnName("CreateArchiveJob_ChapterId"); }); b.HasDiscriminator().HasValue((byte)4); }); modelBuilder.Entity("API.Schema.Jobs.CreateComicInfoXmlJob", b => { b.HasBaseType("API.Schema.Jobs.Job"); b.Property("ChapterId") .IsRequired() .HasMaxLength(64) .HasColumnType("character varying(64)"); b.Property("Path") .IsRequired() .HasColumnType("text"); b.HasIndex("ChapterId"); b.ToTable("Jobs", t => { t.Property("ChapterId") .HasColumnName("CreateComicInfoXmlJob_ChapterId"); }); b.HasDiscriminator().HasValue((byte)6); }); modelBuilder.Entity("API.Schema.Jobs.DownloadNewChaptersJob", b => { b.HasBaseType("API.Schema.Jobs.Job"); b.Property("MangaId") .IsRequired() .HasMaxLength(64) .HasColumnType("character varying(64)"); b.HasIndex("MangaId"); b.HasDiscriminator().HasValue((byte)1); }); modelBuilder.Entity("API.Schema.Jobs.DownloadSingleChapterJob", b => { b.HasBaseType("API.Schema.Jobs.Job"); b.Property("ChapterId") .IsRequired() .HasMaxLength(64) .HasColumnType("character varying(64)"); b.HasIndex("ChapterId"); b.HasDiscriminator().HasValue((byte)0); }); modelBuilder.Entity("API.Schema.Jobs.MoveFileOrFolderJob", b => { b.HasBaseType("API.Schema.Jobs.Job"); b.Property("FromLocation") .IsRequired() .HasColumnType("text"); b.Property("ToLocation") .IsRequired() .HasColumnType("text"); b.HasDiscriminator().HasValue((byte)3); }); modelBuilder.Entity("API.Schema.Jobs.ProcessImagesJob", b => { b.HasBaseType("API.Schema.Jobs.Job"); b.Property("Bw") .HasColumnType("boolean"); b.Property("Compression") .HasColumnType("integer"); b.Property("Path") .IsRequired() .HasColumnType("text"); b.ToTable("Jobs", t => { t.Property("Path") .HasColumnName("ProcessImagesJob_Path"); }); b.HasDiscriminator().HasValue((byte)5); }); modelBuilder.Entity("API.Schema.Jobs.SearchMangaJob", b => { b.HasBaseType("API.Schema.Jobs.Job"); b.Property("MangaConnectorName") .IsRequired() .HasColumnType("text"); b.Property("SearchString") .IsRequired() .HasColumnType("text"); b.HasDiscriminator().HasValue((byte)7); }); modelBuilder.Entity("API.Schema.Jobs.UpdateMetadataJob", b => { b.HasBaseType("API.Schema.Jobs.Job"); b.Property("MangaId") .IsRequired() .HasMaxLength(64) .HasColumnType("character varying(64)"); b.HasIndex("MangaId"); b.ToTable("Jobs", t => { t.Property("MangaId") .HasColumnName("UpdateMetadataJob_MangaId"); }); b.HasDiscriminator().HasValue((byte)2); }); modelBuilder.Entity("API.Schema.LibraryConnectors.Kavita", b => { b.HasBaseType("API.Schema.LibraryConnectors.LibraryConnector"); b.HasDiscriminator().HasValue((byte)1); }); modelBuilder.Entity("API.Schema.LibraryConnectors.Komga", b => { b.HasBaseType("API.Schema.LibraryConnectors.LibraryConnector"); b.HasDiscriminator().HasValue((byte)0); }); modelBuilder.Entity("API.Schema.NotificationConnectors.Gotify", b => { b.HasBaseType("API.Schema.NotificationConnectors.NotificationConnector"); b.Property("AppToken") .IsRequired() .HasColumnType("text"); b.Property("Endpoint") .IsRequired() .HasColumnType("text"); b.HasDiscriminator().HasValue((byte)0); }); modelBuilder.Entity("API.Schema.NotificationConnectors.Lunasea", b => { b.HasBaseType("API.Schema.NotificationConnectors.NotificationConnector"); b.Property("Id") .IsRequired() .HasColumnType("text"); b.HasDiscriminator().HasValue((byte)1); }); modelBuilder.Entity("API.Schema.NotificationConnectors.Ntfy", b => { b.HasBaseType("API.Schema.NotificationConnectors.NotificationConnector"); b.Property("Auth") .IsRequired() .HasColumnType("text"); b.Property("Endpoint") .IsRequired() .HasColumnType("text"); b.Property("Topic") .IsRequired() .HasColumnType("text"); b.ToTable("NotificationConnectors", t => { t.Property("Endpoint") .HasColumnName("Ntfy_Endpoint"); }); b.HasDiscriminator().HasValue((byte)2); }); modelBuilder.Entity("API.Schema.Chapter", b => { b.HasOne("API.Schema.Manga", "ParentManga") .WithMany("Chapters") .HasForeignKey("ParentMangaId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("ParentManga"); }); modelBuilder.Entity("API.Schema.Jobs.Job", b => { b.HasOne("API.Schema.Jobs.Job", null) .WithMany("DependsOnJobs") .HasForeignKey("JobId1"); }); modelBuilder.Entity("API.Schema.Link", b => { b.HasOne("API.Schema.Manga", "Manga") .WithMany("Links") .HasForeignKey("MangaId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Manga"); }); modelBuilder.Entity("API.Schema.Manga", b => { b.HasOne("API.Schema.Chapter", "LatestChapterAvailable") .WithOne() .HasForeignKey("API.Schema.Manga", "LatestChapterAvailableId"); b.HasOne("API.Schema.Chapter", "LatestChapterDownloaded") .WithOne() .HasForeignKey("API.Schema.Manga", "LatestChapterDownloadedId"); b.HasOne("API.Schema.MangaConnector", "MangaConnector") .WithMany("Mangas") .HasForeignKey("MangaConnectorName") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("LatestChapterAvailable"); b.Navigation("LatestChapterDownloaded"); b.Navigation("MangaConnector"); }); modelBuilder.Entity("API.Schema.MangaAltTitle", b => { b.HasOne("API.Schema.Manga", "Manga") .WithMany("AltTitles") .HasForeignKey("MangaId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Manga"); }); modelBuilder.Entity("MangaAuthor", b => { b.HasOne("API.Schema.Author", null) .WithMany() .HasForeignKey("AuthorId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("API.Schema.Manga", null) .WithMany() .HasForeignKey("MangaId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("MangaTag", b => { b.HasOne("API.Schema.Manga", null) .WithMany() .HasForeignKey("MangaId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("API.Schema.MangaTag", null) .WithMany() .HasForeignKey("MangaIds") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("API.Schema.MangaTag", null) .WithMany() .HasForeignKey("Tag") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("API.Schema.Jobs.CreateArchiveJob", b => { b.HasOne("API.Schema.Chapter", "Chapter") .WithMany() .HasForeignKey("ChapterId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Chapter"); }); modelBuilder.Entity("API.Schema.Jobs.CreateComicInfoXmlJob", b => { b.HasOne("API.Schema.Chapter", "Chapter") .WithMany() .HasForeignKey("ChapterId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Chapter"); }); modelBuilder.Entity("API.Schema.Jobs.DownloadNewChaptersJob", b => { b.HasOne("API.Schema.Manga", "Manga") .WithMany() .HasForeignKey("MangaId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Manga"); }); modelBuilder.Entity("API.Schema.Jobs.DownloadSingleChapterJob", b => { b.HasOne("API.Schema.Chapter", "Chapter") .WithMany() .HasForeignKey("ChapterId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Chapter"); }); modelBuilder.Entity("API.Schema.Jobs.UpdateMetadataJob", b => { b.HasOne("API.Schema.Manga", "Manga") .WithMany() .HasForeignKey("MangaId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Manga"); }); modelBuilder.Entity("API.Schema.Jobs.Job", b => { b.Navigation("DependsOnJobs"); }); modelBuilder.Entity("API.Schema.Manga", b => { b.Navigation("AltTitles"); b.Navigation("Chapters"); b.Navigation("Links"); }); modelBuilder.Entity("API.Schema.MangaConnector", b => { b.Navigation("Mangas"); }); #pragma warning restore 612, 618 } } }