db optimizations around names and case-sensitivity (#2749)

* generate (case-insensitive) unique names for fields that should be unique

* move name case-insensitivity down to schema level

* update changelog
This commit is contained in:
Jason Dove
2026-01-02 09:25:23 -06:00
committed by GitHub
parent 80f6e468eb
commit bcd2ea7db3
79 changed files with 29898 additions and 360 deletions
@@ -130,7 +130,8 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("TEXT");
b.Property<string>("Title")
.HasColumnType("TEXT");
.HasColumnType("TEXT")
.UseCollation("NOCASE");
b.Property<int?>("Year")
.HasColumnType("INTEGER");
@@ -139,6 +140,8 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
b.HasIndex("ArtistId");
b.HasIndex("Title");
b.ToTable("ArtistMetadata", (string)null);
});
@@ -304,7 +307,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.UseCollation("NOCASE");
b.Property<string>("Number")
.HasColumnType("TEXT");
@@ -403,7 +408,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.UseCollation("NOCASE");
b.Property<int>("Opacity")
.HasColumnType("INTEGER");
@@ -431,6 +438,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("ChannelWatermark", (string)null);
});
@@ -441,13 +451,18 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.UseCollation("NOCASE");
b.Property<bool>("UseCustomPlaybackOrder")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("Collection", (string)null);
});
@@ -798,7 +813,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.UseCollation("NOCASE");
b.Property<int?>("PadToNearestMinute")
.HasColumnType("INTEGER");
@@ -820,6 +837,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
b.HasIndex("MultiCollectionId");
b.HasIndex("Name")
.IsUnique();
b.HasIndex("PlaylistId");
b.HasIndex("SmartCollectionId");
@@ -1400,7 +1420,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Guid")
.HasColumnType("TEXT");
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.UseCollation("NOCASE");
b.Property<int?>("ImageMetadataId")
.HasColumnType("INTEGER");
@@ -1432,6 +1454,8 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
b.HasIndex("EpisodeMetadataId");
b.HasIndex("Guid");
b.HasIndex("ImageMetadataId");
b.HasIndex("MovieMetadataId");
@@ -1510,7 +1534,8 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("TEXT");
b.Property<string>("Title")
.HasColumnType("TEXT");
.HasColumnType("TEXT")
.UseCollation("NOCASE");
b.Property<int?>("Year")
.HasColumnType("INTEGER");
@@ -1519,6 +1544,8 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
b.HasIndex("MovieId");
b.HasIndex("Title");
b.ToTable("MovieMetadata", (string)null);
});
@@ -1529,10 +1556,15 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.UseCollation("NOCASE");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("MultiCollection", (string)null);
});
@@ -1708,7 +1740,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.UseCollation("NOCASE");
b.Property<int>("PlaylistGroupId")
.HasColumnType("INTEGER");
@@ -2147,7 +2181,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.UseCollation("NOCASE");
b.Property<bool>("RandomStartPoint")
.HasColumnType("INTEGER");
@@ -2427,7 +2463,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.UseCollation("NOCASE");
b.Property<int>("RerunPlaybackOrder")
.HasColumnType("INTEGER");
@@ -2443,6 +2481,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
b.HasIndex("MultiCollectionId");
b.HasIndex("Name")
.IsUnique();
b.HasIndex("SmartCollectionId");
b.ToTable("RerunCollection", (string)null);
@@ -2489,7 +2530,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.UseCollation("NOCASE");
b.Property<int>("StopScheduling")
.HasColumnType("INTEGER");
@@ -2509,7 +2552,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.UseCollation("NOCASE");
b.HasKey("Id");
@@ -2631,7 +2676,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.UseCollation("NOCASE");
b.Property<bool>("UseGraphicsElementsDuringFiller")
.HasColumnType("INTEGER");
@@ -2720,7 +2767,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.UseCollation("NOCASE");
b.HasKey("Id");
@@ -2743,7 +2792,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.UseCollation("NOCASE");
b.HasKey("Id");
@@ -2760,7 +2811,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.UseCollation("NOCASE");
b.HasKey("Id");
@@ -2937,7 +2990,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.UseCollation("NOCASE");
b.Property<int>("TemplateGroupId")
.HasColumnType("INTEGER");
@@ -2957,7 +3012,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.UseCollation("NOCASE");
b.HasKey("Id");
@@ -3074,7 +3131,8 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("TEXT");
b.Property<string>("Title")
.HasColumnType("TEXT");
.HasColumnType("TEXT")
.UseCollation("NOCASE");
b.Property<int?>("Year")
.HasColumnType("INTEGER");
@@ -3083,6 +3141,8 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
b.HasIndex("ShowId");
b.HasIndex("Title");
b.ToTable("ShowMetadata", (string)null);
});
@@ -3093,7 +3153,8 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("INTEGER");
b.Property<string>("Name")
.HasColumnType("TEXT")
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.UseCollation("NOCASE");
b.Property<string>("Query")
@@ -3444,7 +3505,8 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasColumnType("TEXT")
.UseCollation("NOCASE");
b.Property<int?>("PlaylistId")
.HasColumnType("INTEGER");
@@ -3457,6 +3519,8 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
b.HasKey("Id");
b.HasIndex("Name");
b.HasIndex("PlaylistId");
b.ToTable("TraktList", (string)null);