Add ItemId to all display preferences

This commit is contained in:
crobibero
2020-12-04 16:00:11 -07:00
parent 8d8738835e
commit 3db6ae91f6
11 changed files with 117 additions and 32 deletions

View File

@@ -10,7 +10,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Jellyfin.Server.Implementations.Migrations
{
[DbContext(typeof(JellyfinDb))]
[Migration("20201203203707_AddCustomDisplayPreferences")]
[Migration("20201204223655_AddCustomDisplayPreferences")]
partial class AddCustomDisplayPreferences
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -102,6 +102,9 @@ namespace Jellyfin.Server.Implementations.Migrations
.HasMaxLength(32)
.HasColumnType("TEXT");
b.Property<Guid>("ItemId")
.HasColumnType("TEXT");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("TEXT");
@@ -117,7 +120,7 @@ namespace Jellyfin.Server.Implementations.Migrations
b.HasIndex("UserId");
b.HasIndex("UserId", "Client", "Key")
b.HasIndex("UserId", "ItemId", "Client", "Key")
.IsUnique();
b.ToTable("CustomItemDisplayPreferences");
@@ -147,6 +150,9 @@ namespace Jellyfin.Server.Implementations.Migrations
b.Property<int?>("IndexBy")
.HasColumnType("INTEGER");
b.Property<Guid>("ItemId")
.HasColumnType("TEXT");
b.Property<int>("ScrollDirection")
.HasColumnType("INTEGER");
@@ -173,7 +179,7 @@ namespace Jellyfin.Server.Implementations.Migrations
b.HasIndex("UserId");
b.HasIndex("UserId", "Client")
b.HasIndex("UserId", "ItemId", "Client")
.IsUnique();
b.ToTable("DisplayPreferences");

View File

@@ -9,6 +9,11 @@ namespace Jellyfin.Server.Implementations.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_DisplayPreferences_UserId_Client",
schema: "jellyfin",
table: "DisplayPreferences");
migrationBuilder.AlterColumn<int>(
name: "MaxActiveSessions",
schema: "jellyfin",
@@ -20,6 +25,14 @@ namespace Jellyfin.Server.Implementations.Migrations
oldType: "INTEGER",
oldNullable: true);
migrationBuilder.AddColumn<Guid>(
name: "ItemId",
schema: "jellyfin",
table: "DisplayPreferences",
type: "TEXT",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.CreateTable(
name: "CustomItemDisplayPreferences",
schema: "jellyfin",
@@ -28,6 +41,7 @@ namespace Jellyfin.Server.Implementations.Migrations
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
UserId = table.Column<Guid>(type: "TEXT", nullable: false),
ItemId = table.Column<Guid>(type: "TEXT", nullable: false),
Client = table.Column<string>(type: "TEXT", maxLength: 32, nullable: false),
Key = table.Column<string>(type: "TEXT", nullable: false),
Value = table.Column<string>(type: "TEXT", nullable: false)
@@ -37,6 +51,13 @@ namespace Jellyfin.Server.Implementations.Migrations
table.PrimaryKey("PK_CustomItemDisplayPreferences", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_DisplayPreferences_UserId_ItemId_Client",
schema: "jellyfin",
table: "DisplayPreferences",
columns: new[] { "UserId", "ItemId", "Client" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_CustomItemDisplayPreferences_UserId",
schema: "jellyfin",
@@ -44,10 +65,10 @@ namespace Jellyfin.Server.Implementations.Migrations
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_CustomItemDisplayPreferences_UserId_Client_Key",
name: "IX_CustomItemDisplayPreferences_UserId_ItemId_Client_Key",
schema: "jellyfin",
table: "CustomItemDisplayPreferences",
columns: new[] { "UserId", "Client", "Key" },
columns: new[] { "UserId", "ItemId", "Client", "Key" },
unique: true);
}
@@ -57,6 +78,16 @@ namespace Jellyfin.Server.Implementations.Migrations
name: "CustomItemDisplayPreferences",
schema: "jellyfin");
migrationBuilder.DropIndex(
name: "IX_DisplayPreferences_UserId_ItemId_Client",
schema: "jellyfin",
table: "DisplayPreferences");
migrationBuilder.DropColumn(
name: "ItemId",
schema: "jellyfin",
table: "DisplayPreferences");
migrationBuilder.AlterColumn<int>(
name: "MaxActiveSessions",
schema: "jellyfin",
@@ -65,6 +96,13 @@ namespace Jellyfin.Server.Implementations.Migrations
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER");
migrationBuilder.CreateIndex(
name: "IX_DisplayPreferences_UserId_Client",
schema: "jellyfin",
table: "DisplayPreferences",
columns: new[] { "UserId", "Client" },
unique: true);
}
}
}

View File

@@ -99,6 +99,9 @@ namespace Jellyfin.Server.Implementations.Migrations
.HasMaxLength(32)
.HasColumnType("TEXT");
b.Property<Guid>("ItemId")
.HasColumnType("TEXT");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("TEXT");
@@ -114,7 +117,7 @@ namespace Jellyfin.Server.Implementations.Migrations
b.HasIndex("UserId");
b.HasIndex("UserId", "Client", "Key")
b.HasIndex("UserId", "ItemId", "Client", "Key")
.IsUnique();
b.ToTable("CustomItemDisplayPreferences");
@@ -144,6 +147,9 @@ namespace Jellyfin.Server.Implementations.Migrations
b.Property<int?>("IndexBy")
.HasColumnType("INTEGER");
b.Property<Guid>("ItemId")
.HasColumnType("TEXT");
b.Property<int>("ScrollDirection")
.HasColumnType("INTEGER");
@@ -170,7 +176,7 @@ namespace Jellyfin.Server.Implementations.Migrations
b.HasIndex("UserId");
b.HasIndex("UserId", "Client")
b.HasIndex("UserId", "ItemId", "Client")
.IsUnique();
b.ToTable("DisplayPreferences");