ソースを参照

Recreate display preferences migration.

Patrick Barron 4 年 前
コミット
c3a36485b6

+ 66 - 23
Jellyfin.Server.Implementations/Migrations/20200717233541_AddDisplayPreferences.Designer.cs → Jellyfin.Server.Implementations/Migrations/20200728005145_AddDisplayPreferences.Designer.cs

@@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 namespace Jellyfin.Server.Implementations.Migrations
 namespace Jellyfin.Server.Implementations.Migrations
 {
 {
     [DbContext(typeof(JellyfinDb))]
     [DbContext(typeof(JellyfinDb))]
-    [Migration("20200717233541_AddDisplayPreferences")]
+    [Migration("20200728005145_AddDisplayPreferences")]
     partial class AddDisplayPreferences
     partial class AddDisplayPreferences
     {
     {
         protected override void BuildTargetModel(ModelBuilder modelBuilder)
         protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -19,7 +19,7 @@ namespace Jellyfin.Server.Implementations.Migrations
 #pragma warning disable 612, 618
 #pragma warning disable 612, 618
             modelBuilder
             modelBuilder
                 .HasDefaultSchema("jellyfin")
                 .HasDefaultSchema("jellyfin")
-                .HasAnnotation("ProductVersion", "3.1.5");
+                .HasAnnotation("ProductVersion", "3.1.6");
 
 
             modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b =>
             modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b =>
                 {
                 {
@@ -104,7 +104,11 @@ namespace Jellyfin.Server.Implementations.Migrations
                     b.Property<string>("Client")
                     b.Property<string>("Client")
                         .IsRequired()
                         .IsRequired()
                         .HasColumnType("TEXT")
                         .HasColumnType("TEXT")
-                        .HasMaxLength(64);
+                        .HasMaxLength(32);
+
+                    b.Property<string>("DashboardTheme")
+                        .HasColumnType("TEXT")
+                        .HasMaxLength(32);
 
 
                     b.Property<bool>("EnableNextVideoInfoOverlay")
                     b.Property<bool>("EnableNextVideoInfoOverlay")
                         .HasColumnType("INTEGER");
                         .HasColumnType("INTEGER");
@@ -112,15 +116,6 @@ namespace Jellyfin.Server.Implementations.Migrations
                     b.Property<int?>("IndexBy")
                     b.Property<int?>("IndexBy")
                         .HasColumnType("INTEGER");
                         .HasColumnType("INTEGER");
 
 
-                    b.Property<Guid?>("ItemId")
-                        .HasColumnType("TEXT");
-
-                    b.Property<bool>("RememberIndexing")
-                        .HasColumnType("INTEGER");
-
-                    b.Property<bool>("RememberSorting")
-                        .HasColumnType("INTEGER");
-
                     b.Property<int>("ScrollDirection")
                     b.Property<int>("ScrollDirection")
                         .HasColumnType("INTEGER");
                         .HasColumnType("INTEGER");
 
 
@@ -136,22 +131,17 @@ namespace Jellyfin.Server.Implementations.Migrations
                     b.Property<int>("SkipForwardLength")
                     b.Property<int>("SkipForwardLength")
                         .HasColumnType("INTEGER");
                         .HasColumnType("INTEGER");
 
 
-                    b.Property<string>("SortBy")
+                    b.Property<string>("TvHome")
                         .HasColumnType("TEXT")
                         .HasColumnType("TEXT")
-                        .HasMaxLength(64);
-
-                    b.Property<int>("SortOrder")
-                        .HasColumnType("INTEGER");
+                        .HasMaxLength(32);
 
 
                     b.Property<Guid>("UserId")
                     b.Property<Guid>("UserId")
                         .HasColumnType("TEXT");
                         .HasColumnType("TEXT");
 
 
-                    b.Property<int?>("ViewType")
-                        .HasColumnType("INTEGER");
-
                     b.HasKey("Id");
                     b.HasKey("Id");
 
 
-                    b.HasIndex("UserId");
+                    b.HasIndex("UserId")
+                        .IsUnique();
 
 
                     b.ToTable("DisplayPreferences");
                     b.ToTable("DisplayPreferences");
                 });
                 });
@@ -203,6 +193,50 @@ namespace Jellyfin.Server.Implementations.Migrations
                     b.ToTable("ImageInfos");
                     b.ToTable("ImageInfos");
                 });
                 });
 
 
+            modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("INTEGER");
+
+                    b.Property<string>("Client")
+                        .IsRequired()
+                        .HasColumnType("TEXT")
+                        .HasMaxLength(32);
+
+                    b.Property<int?>("IndexBy")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<Guid>("ItemId")
+                        .HasColumnType("TEXT");
+
+                    b.Property<bool>("RememberIndexing")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<bool>("RememberSorting")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<string>("SortBy")
+                        .IsRequired()
+                        .HasColumnType("TEXT")
+                        .HasMaxLength(64);
+
+                    b.Property<int>("SortOrder")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<Guid>("UserId")
+                        .HasColumnType("TEXT");
+
+                    b.Property<int>("ViewType")
+                        .HasColumnType("INTEGER");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("UserId");
+
+                    b.ToTable("ItemDisplayPreferences");
+                });
+
             modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b =>
             modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b =>
                 {
                 {
                     b.Property<int>("Id")
                     b.Property<int>("Id")
@@ -375,8 +409,8 @@ namespace Jellyfin.Server.Implementations.Migrations
             modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b =>
             modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b =>
                 {
                 {
                     b.HasOne("Jellyfin.Data.Entities.User", null)
                     b.HasOne("Jellyfin.Data.Entities.User", null)
-                        .WithMany("DisplayPreferences")
-                        .HasForeignKey("UserId")
+                        .WithOne("DisplayPreferences")
+                        .HasForeignKey("Jellyfin.Data.Entities.DisplayPreferences", "UserId")
                         .OnDelete(DeleteBehavior.Cascade)
                         .OnDelete(DeleteBehavior.Cascade)
                         .IsRequired();
                         .IsRequired();
                 });
                 });
@@ -397,6 +431,15 @@ namespace Jellyfin.Server.Implementations.Migrations
                         .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId");
                         .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId");
                 });
                 });
 
 
+            modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b =>
+                {
+                    b.HasOne("Jellyfin.Data.Entities.User", null)
+                        .WithMany("ItemDisplayPreferences")
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
             modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b =>
             modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b =>
                 {
                 {
                     b.HasOne("Jellyfin.Data.Entities.User", null)
                     b.HasOne("Jellyfin.Data.Entities.User", null)

+ 45 - 9
Jellyfin.Server.Implementations/Migrations/20200717233541_AddDisplayPreferences.cs → Jellyfin.Server.Implementations/Migrations/20200728005145_AddDisplayPreferences.cs

@@ -18,21 +18,17 @@ namespace Jellyfin.Server.Implementations.Migrations
                     Id = table.Column<int>(nullable: false)
                     Id = table.Column<int>(nullable: false)
                         .Annotation("Sqlite:Autoincrement", true),
                         .Annotation("Sqlite:Autoincrement", true),
                     UserId = table.Column<Guid>(nullable: false),
                     UserId = table.Column<Guid>(nullable: false),
-                    ItemId = table.Column<Guid>(nullable: true),
-                    Client = table.Column<string>(maxLength: 64, nullable: false),
-                    RememberIndexing = table.Column<bool>(nullable: false),
-                    RememberSorting = table.Column<bool>(nullable: false),
-                    SortOrder = table.Column<int>(nullable: false),
+                    Client = table.Column<string>(maxLength: 32, nullable: false),
                     ShowSidebar = table.Column<bool>(nullable: false),
                     ShowSidebar = table.Column<bool>(nullable: false),
                     ShowBackdrop = table.Column<bool>(nullable: false),
                     ShowBackdrop = table.Column<bool>(nullable: false),
-                    SortBy = table.Column<string>(maxLength: 64, nullable: true),
-                    ViewType = table.Column<int>(nullable: true),
                     ScrollDirection = table.Column<int>(nullable: false),
                     ScrollDirection = table.Column<int>(nullable: false),
                     IndexBy = table.Column<int>(nullable: true),
                     IndexBy = table.Column<int>(nullable: true),
                     SkipForwardLength = table.Column<int>(nullable: false),
                     SkipForwardLength = table.Column<int>(nullable: false),
                     SkipBackwardLength = table.Column<int>(nullable: false),
                     SkipBackwardLength = table.Column<int>(nullable: false),
                     ChromecastVersion = table.Column<int>(nullable: false),
                     ChromecastVersion = table.Column<int>(nullable: false),
-                    EnableNextVideoInfoOverlay = table.Column<bool>(nullable: false)
+                    EnableNextVideoInfoOverlay = table.Column<bool>(nullable: false),
+                    DashboardTheme = table.Column<string>(maxLength: 32, nullable: true),
+                    TvHome = table.Column<string>(maxLength: 32, nullable: true)
                 },
                 },
                 constraints: table =>
                 constraints: table =>
                 {
                 {
@@ -46,6 +42,35 @@ namespace Jellyfin.Server.Implementations.Migrations
                         onDelete: ReferentialAction.Cascade);
                         onDelete: ReferentialAction.Cascade);
                 });
                 });
 
 
+            migrationBuilder.CreateTable(
+                name: "ItemDisplayPreferences",
+                schema: "jellyfin",
+                columns: table => new
+                {
+                    Id = table.Column<int>(nullable: false)
+                        .Annotation("Sqlite:Autoincrement", true),
+                    UserId = table.Column<Guid>(nullable: false),
+                    ItemId = table.Column<Guid>(nullable: false),
+                    Client = table.Column<string>(maxLength: 32, nullable: false),
+                    ViewType = table.Column<int>(nullable: false),
+                    RememberIndexing = table.Column<bool>(nullable: false),
+                    IndexBy = table.Column<int>(nullable: true),
+                    RememberSorting = table.Column<bool>(nullable: false),
+                    SortBy = table.Column<string>(maxLength: 64, nullable: false),
+                    SortOrder = table.Column<int>(nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_ItemDisplayPreferences", x => x.Id);
+                    table.ForeignKey(
+                        name: "FK_ItemDisplayPreferences_Users_UserId",
+                        column: x => x.UserId,
+                        principalSchema: "jellyfin",
+                        principalTable: "Users",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                });
+
             migrationBuilder.CreateTable(
             migrationBuilder.CreateTable(
                 name: "HomeSection",
                 name: "HomeSection",
                 schema: "jellyfin",
                 schema: "jellyfin",
@@ -73,13 +98,20 @@ namespace Jellyfin.Server.Implementations.Migrations
                 name: "IX_DisplayPreferences_UserId",
                 name: "IX_DisplayPreferences_UserId",
                 schema: "jellyfin",
                 schema: "jellyfin",
                 table: "DisplayPreferences",
                 table: "DisplayPreferences",
-                column: "UserId");
+                column: "UserId",
+                unique: true);
 
 
             migrationBuilder.CreateIndex(
             migrationBuilder.CreateIndex(
                 name: "IX_HomeSection_DisplayPreferencesId",
                 name: "IX_HomeSection_DisplayPreferencesId",
                 schema: "jellyfin",
                 schema: "jellyfin",
                 table: "HomeSection",
                 table: "HomeSection",
                 column: "DisplayPreferencesId");
                 column: "DisplayPreferencesId");
+
+            migrationBuilder.CreateIndex(
+                name: "IX_ItemDisplayPreferences_UserId",
+                schema: "jellyfin",
+                table: "ItemDisplayPreferences",
+                column: "UserId");
         }
         }
 
 
         protected override void Down(MigrationBuilder migrationBuilder)
         protected override void Down(MigrationBuilder migrationBuilder)
@@ -88,6 +120,10 @@ namespace Jellyfin.Server.Implementations.Migrations
                 name: "HomeSection",
                 name: "HomeSection",
                 schema: "jellyfin");
                 schema: "jellyfin");
 
 
+            migrationBuilder.DropTable(
+                name: "ItemDisplayPreferences",
+                schema: "jellyfin");
+
             migrationBuilder.DropTable(
             migrationBuilder.DropTable(
                 name: "DisplayPreferences",
                 name: "DisplayPreferences",
                 schema: "jellyfin");
                 schema: "jellyfin");

+ 65 - 22
Jellyfin.Server.Implementations/Migrations/JellyfinDbModelSnapshot.cs

@@ -15,7 +15,7 @@ namespace Jellyfin.Server.Implementations.Migrations
 #pragma warning disable 612, 618
 #pragma warning disable 612, 618
             modelBuilder
             modelBuilder
                 .HasDefaultSchema("jellyfin")
                 .HasDefaultSchema("jellyfin")
-                .HasAnnotation("ProductVersion", "3.1.5");
+                .HasAnnotation("ProductVersion", "3.1.6");
 
 
             modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b =>
             modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b =>
                 {
                 {
@@ -100,7 +100,11 @@ namespace Jellyfin.Server.Implementations.Migrations
                     b.Property<string>("Client")
                     b.Property<string>("Client")
                         .IsRequired()
                         .IsRequired()
                         .HasColumnType("TEXT")
                         .HasColumnType("TEXT")
-                        .HasMaxLength(64);
+                        .HasMaxLength(32);
+
+                    b.Property<string>("DashboardTheme")
+                        .HasColumnType("TEXT")
+                        .HasMaxLength(32);
 
 
                     b.Property<bool>("EnableNextVideoInfoOverlay")
                     b.Property<bool>("EnableNextVideoInfoOverlay")
                         .HasColumnType("INTEGER");
                         .HasColumnType("INTEGER");
@@ -108,15 +112,6 @@ namespace Jellyfin.Server.Implementations.Migrations
                     b.Property<int?>("IndexBy")
                     b.Property<int?>("IndexBy")
                         .HasColumnType("INTEGER");
                         .HasColumnType("INTEGER");
 
 
-                    b.Property<Guid?>("ItemId")
-                        .HasColumnType("TEXT");
-
-                    b.Property<bool>("RememberIndexing")
-                        .HasColumnType("INTEGER");
-
-                    b.Property<bool>("RememberSorting")
-                        .HasColumnType("INTEGER");
-
                     b.Property<int>("ScrollDirection")
                     b.Property<int>("ScrollDirection")
                         .HasColumnType("INTEGER");
                         .HasColumnType("INTEGER");
 
 
@@ -132,22 +127,17 @@ namespace Jellyfin.Server.Implementations.Migrations
                     b.Property<int>("SkipForwardLength")
                     b.Property<int>("SkipForwardLength")
                         .HasColumnType("INTEGER");
                         .HasColumnType("INTEGER");
 
 
-                    b.Property<string>("SortBy")
+                    b.Property<string>("TvHome")
                         .HasColumnType("TEXT")
                         .HasColumnType("TEXT")
-                        .HasMaxLength(64);
-
-                    b.Property<int>("SortOrder")
-                        .HasColumnType("INTEGER");
+                        .HasMaxLength(32);
 
 
                     b.Property<Guid>("UserId")
                     b.Property<Guid>("UserId")
                         .HasColumnType("TEXT");
                         .HasColumnType("TEXT");
 
 
-                    b.Property<int?>("ViewType")
-                        .HasColumnType("INTEGER");
-
                     b.HasKey("Id");
                     b.HasKey("Id");
 
 
-                    b.HasIndex("UserId");
+                    b.HasIndex("UserId")
+                        .IsUnique();
 
 
                     b.ToTable("DisplayPreferences");
                     b.ToTable("DisplayPreferences");
                 });
                 });
@@ -199,6 +189,50 @@ namespace Jellyfin.Server.Implementations.Migrations
                     b.ToTable("ImageInfos");
                     b.ToTable("ImageInfos");
                 });
                 });
 
 
+            modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("INTEGER");
+
+                    b.Property<string>("Client")
+                        .IsRequired()
+                        .HasColumnType("TEXT")
+                        .HasMaxLength(32);
+
+                    b.Property<int?>("IndexBy")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<Guid>("ItemId")
+                        .HasColumnType("TEXT");
+
+                    b.Property<bool>("RememberIndexing")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<bool>("RememberSorting")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<string>("SortBy")
+                        .IsRequired()
+                        .HasColumnType("TEXT")
+                        .HasMaxLength(64);
+
+                    b.Property<int>("SortOrder")
+                        .HasColumnType("INTEGER");
+
+                    b.Property<Guid>("UserId")
+                        .HasColumnType("TEXT");
+
+                    b.Property<int>("ViewType")
+                        .HasColumnType("INTEGER");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("UserId");
+
+                    b.ToTable("ItemDisplayPreferences");
+                });
+
             modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b =>
             modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b =>
                 {
                 {
                     b.Property<int>("Id")
                     b.Property<int>("Id")
@@ -371,8 +405,8 @@ namespace Jellyfin.Server.Implementations.Migrations
             modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b =>
             modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b =>
                 {
                 {
                     b.HasOne("Jellyfin.Data.Entities.User", null)
                     b.HasOne("Jellyfin.Data.Entities.User", null)
-                        .WithMany("DisplayPreferences")
-                        .HasForeignKey("UserId")
+                        .WithOne("DisplayPreferences")
+                        .HasForeignKey("Jellyfin.Data.Entities.DisplayPreferences", "UserId")
                         .OnDelete(DeleteBehavior.Cascade)
                         .OnDelete(DeleteBehavior.Cascade)
                         .IsRequired();
                         .IsRequired();
                 });
                 });
@@ -393,6 +427,15 @@ namespace Jellyfin.Server.Implementations.Migrations
                         .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId");
                         .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId");
                 });
                 });
 
 
+            modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b =>
+                {
+                    b.HasOne("Jellyfin.Data.Entities.User", null)
+                        .WithMany("ItemDisplayPreferences")
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
             modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b =>
             modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b =>
                 {
                 {
                     b.HasOne("Jellyfin.Data.Entities.User", null)
                     b.HasOne("Jellyfin.Data.Entities.User", null)