// using System; using System.Collections; using Lactose.Context; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace Lactose.Migrations { [DbContext(typeof(LactoseDbContext))] [Migration("20260712162406_AddTrigramIndexes")] partial class AddTrigramIndexes { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "10.0.9") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "pg_trgm"); NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "vector"); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("AlbumAsset", b => { b.Property("AlbumsId") .HasColumnType("uuid"); b.Property("AssetsId") .HasColumnType("uuid"); b.HasKey("AlbumsId", "AssetsId"); b.HasIndex("AssetsId"); b.ToTable("AlbumAsset"); }); modelBuilder.Entity("AssetTag", b => { b.Property("AssetsId") .HasColumnType("uuid"); b.Property("TagsId") .HasColumnType("uuid"); b.HasKey("AssetsId", "TagsId"); b.HasIndex("TagsId"); b.ToTable("AssetTag"); }); modelBuilder.Entity("AssetUser", b => { b.Property("SharedAssetsId") .HasColumnType("uuid"); b.Property("SharedWithId") .HasColumnType("uuid"); b.HasKey("SharedAssetsId", "SharedWithId"); b.HasIndex("SharedWithId"); b.ToTable("AssetUser"); }); modelBuilder.Entity("Lactose.Models.Album", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("CoverAssetId") .HasColumnType("uuid"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("PersonOwnerId") .HasColumnType("uuid"); b.Property("Title") .IsRequired() .HasColumnType("VARCHAR(255)"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.Property("UserOwnerId") .HasColumnType("uuid"); b.HasKey("Id"); b.HasIndex("CoverAssetId"); b.HasIndex("PersonOwnerId"); b.HasIndex("Title") .HasDatabaseName("IX_Albums_Title_Trgm"); NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("Title"), "gin"); NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex("Title"), new[] { "gin_trgm_ops" }); b.HasIndex("UserOwnerId"); b.ToTable("Albums"); }); modelBuilder.Entity("Lactose.Models.Asset", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone"); b.Property("Duration") .HasColumnType("real"); b.Property("FileSize") .HasColumnType("bigint"); b.Property("FolderId") .HasColumnType("uuid"); b.Property("FrameRate") .HasColumnType("real"); b.Property("Hash") .IsRequired() .HasColumnType("bit(64)"); b.Property("IsPubliclyShared") .HasColumnType("boolean"); b.Property("MimeType") .IsRequired() .HasColumnType("VARCHAR(255)"); b.Property("OriginalFilename") .IsRequired() .HasColumnType("VARCHAR(255)"); b.Property("OriginalPath") .IsRequired() .HasColumnType("VARCHAR(2048)"); b.Property("OwnerId") .HasColumnType("uuid"); b.Property("PreviewFormat") .IsRequired() .HasColumnType("VARCHAR(16)"); b.Property("PreviewPath") .IsRequired() .HasColumnType("VARCHAR(2048)"); b.Property("PreviewSize") .HasColumnType("integer"); b.Property("ResolutionHeight") .HasColumnType("integer"); b.Property("ResolutionWidth") .HasColumnType("integer"); b.Property("ThumbnailFormat") .IsRequired() .HasColumnType("VARCHAR(16)"); b.Property("ThumbnailPath") .IsRequired() .HasColumnType("VARCHAR(2048)"); b.Property("ThumbnailSize") .HasColumnType("integer"); b.Property("Type") .HasColumnType("integer"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("FolderId"); b.HasIndex("OriginalPath") .IsUnique(); b.HasIndex("OwnerId"); b.HasIndex("IsPubliclyShared", "OwnerId") .HasDatabaseName("IX_Assets_VisibleForSearch") .HasFilter("\"DeletedAt\" IS NULL"); b.ToTable("Assets"); }); modelBuilder.Entity("Lactose.Models.Face", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("AssetId") .HasColumnType("uuid"); b.Property("BoundingBoxX1") .HasColumnType("integer"); b.Property("BoundingBoxX2") .HasColumnType("integer"); b.Property("BoundingBoxY1") .HasColumnType("integer"); b.Property("BoundingBoxY2") .HasColumnType("integer"); b.Property("ImageHeight") .HasColumnType("integer"); b.Property("ImageWidth") .HasColumnType("integer"); b.Property("PersonId") .HasColumnType("uuid"); b.HasKey("Id"); b.HasIndex("AssetId"); b.HasIndex("PersonId"); b.ToTable("Faces"); }); modelBuilder.Entity("Lactose.Models.Folder", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("Active") .HasColumnType("boolean"); b.Property("BasePath") .IsRequired() .HasColumnType("VARCHAR(2048)"); b.Property("RegexPattern") .HasMaxLength(2048) .HasColumnType("character varying(2048)"); b.HasKey("Id"); b.ToTable("Folders"); }); modelBuilder.Entity("Lactose.Models.JobRecord", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("Created") .HasColumnType("timestamp with time zone"); b.Property("Finished") .HasColumnType("timestamp with time zone"); b.Property("JobType") .HasColumnType("integer"); b.Property("Message") .HasColumnType("VARCHAR(2048)"); b.Property("ModifiedAt") .HasColumnType("timestamp with time zone"); b.Property("Name") .IsRequired() .HasColumnType("VARCHAR(2048)"); b.Property("ParentJobId") .HasColumnType("uuid"); b.Property("Progress") .HasColumnType("real"); b.Property("Started") .HasColumnType("timestamp with time zone"); b.Property("Status") .HasColumnType("integer"); b.HasKey("Id"); b.ToTable("JobRecords"); }); modelBuilder.Entity("Lactose.Models.Person", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("Name") .IsRequired() .HasColumnType("VARCHAR(255)"); b.Property("ProfileAssetId") .HasColumnType("uuid"); b.Property("ProfileCropX") .HasColumnType("real"); b.Property("ProfileCropY") .HasColumnType("real"); b.Property("ProfileCropZoom") .HasColumnType("real"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("Name") .HasDatabaseName("IX_People_Name_Trgm"); NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("Name"), "gin"); NpgsqlIndexBuilderExtensions.HasOperators(b.HasIndex("Name"), new[] { "gin_trgm_ops" }); b.HasIndex("ProfileAssetId"); b.ToTable("People"); }); modelBuilder.Entity("Lactose.Models.Setting", b => { b.Property("Name") .HasMaxLength(50) .HasColumnType("character varying(50)"); b.Property("Description") .HasMaxLength(2048) .HasColumnType("character varying(2048)"); b.Property("DisplayType") .HasColumnType("integer"); b.PrimitiveCollection("Options") .HasColumnType("text[]"); b.Property("Type") .HasColumnType("integer"); b.Property("Value") .HasMaxLength(1024) .HasColumnType("character varying(1024)"); b.HasKey("Name"); b.ToTable("Settings"); }); modelBuilder.Entity("Lactose.Models.Tag", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("Name") .IsRequired() .HasColumnType("VARCHAR(255)"); b.Property("ParentId") .HasColumnType("uuid"); b.HasKey("Id"); b.HasIndex("ParentId"); b.ToTable("Tags"); }); modelBuilder.Entity("Lactose.Models.User", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("AccessLevel") .HasColumnType("integer"); b.Property("BannedAt") .HasColumnType("timestamp with time zone"); b.Property("CreatedAt") .HasColumnType("timestamp with time zone"); b.Property("DeletedAt") .HasColumnType("timestamp with time zone"); b.Property("Email") .IsRequired() .HasColumnType("VARCHAR(128)"); b.Property("LastLogin") .HasColumnType("timestamp with time zone"); b.Property("Password") .IsRequired() .HasColumnType("VARCHAR(255)"); b.Property("RefreshToken") .IsRequired() .HasColumnType("VARCHAR(255)"); b.Property("RefreshTokenExpires") .HasColumnType("timestamp with time zone"); b.Property("UpdatedAt") .HasColumnType("timestamp with time zone"); b.Property("Username") .IsRequired() .HasColumnType("VARCHAR(64)"); b.HasKey("Id"); b.ToTable("Users"); }); modelBuilder.Entity("AlbumAsset", b => { b.HasOne("Lactose.Models.Album", null) .WithMany() .HasForeignKey("AlbumsId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("Lactose.Models.Asset", null) .WithMany() .HasForeignKey("AssetsId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("AssetTag", b => { b.HasOne("Lactose.Models.Asset", null) .WithMany() .HasForeignKey("AssetsId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("Lactose.Models.Tag", null) .WithMany() .HasForeignKey("TagsId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("AssetUser", b => { b.HasOne("Lactose.Models.Asset", null) .WithMany() .HasForeignKey("SharedAssetsId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("Lactose.Models.User", null) .WithMany() .HasForeignKey("SharedWithId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Lactose.Models.Album", b => { b.HasOne("Lactose.Models.Asset", "CoverAsset") .WithMany() .HasForeignKey("CoverAssetId"); b.HasOne("Lactose.Models.Person", "PersonOwner") .WithMany("Albums") .HasForeignKey("PersonOwnerId"); b.HasOne("Lactose.Models.User", "UserOwner") .WithMany("OwnedAlbums") .HasForeignKey("UserOwnerId"); b.Navigation("CoverAsset"); b.Navigation("PersonOwner"); b.Navigation("UserOwner"); }); modelBuilder.Entity("Lactose.Models.Asset", b => { b.HasOne("Lactose.Models.Folder", "Folder") .WithMany("Assets") .HasForeignKey("FolderId"); b.HasOne("Lactose.Models.User", "Owner") .WithMany("OwnedAssets") .HasForeignKey("OwnerId"); b.Navigation("Folder"); b.Navigation("Owner"); }); modelBuilder.Entity("Lactose.Models.Face", b => { b.HasOne("Lactose.Models.Asset", "Asset") .WithMany("Faces") .HasForeignKey("AssetId"); b.HasOne("Lactose.Models.Person", "Person") .WithMany("Faces") .HasForeignKey("PersonId"); b.Navigation("Asset"); b.Navigation("Person"); }); modelBuilder.Entity("Lactose.Models.Person", b => { b.HasOne("Lactose.Models.Asset", "ProfileAsset") .WithMany() .HasForeignKey("ProfileAssetId"); b.Navigation("ProfileAsset"); }); modelBuilder.Entity("Lactose.Models.Tag", b => { b.HasOne("Lactose.Models.Tag", "Parent") .WithMany() .HasForeignKey("ParentId"); b.Navigation("Parent"); }); modelBuilder.Entity("Lactose.Models.Asset", b => { b.Navigation("Faces"); }); modelBuilder.Entity("Lactose.Models.Folder", b => { b.Navigation("Assets"); }); modelBuilder.Entity("Lactose.Models.Person", b => { b.Navigation("Albums"); b.Navigation("Faces"); }); modelBuilder.Entity("Lactose.Models.User", b => { b.Navigation("OwnedAlbums"); b.Navigation("OwnedAssets"); }); #pragma warning restore 612, 618 } } }