diff options
| author | Patrick Barron <barronpm@gmail.com> | 2020-05-15 17:24:01 -0400 |
|---|---|---|
| committer | Patrick Barron <barronpm@gmail.com> | 2020-05-20 10:04:00 -0400 |
| commit | 3eeb6576d8425c8d2917f861b466dfa36e3994df (patch) | |
| tree | b725c19d776a1ee11f3cc7686a01069c9d443e48 /Jellyfin.Server.Implementations/Migrations | |
| parent | aca7e221d811040bdb14da6390bbd16c5f7db785 (diff) | |
Migrate User DB to EF Core
Diffstat (limited to 'Jellyfin.Server.Implementations/Migrations')
| -rw-r--r-- | Jellyfin.Server.Implementations/Migrations/20200517002411_AddUsers.Designer.cs (renamed from Jellyfin.Server.Implementations/Migrations/20200504195702_UserSchema.Designer.cs) | 192 | ||||
| -rw-r--r-- | Jellyfin.Server.Implementations/Migrations/20200517002411_AddUsers.cs (renamed from Jellyfin.Server.Implementations/Migrations/20200504195702_UserSchema.cs) | 198 | ||||
| -rw-r--r-- | Jellyfin.Server.Implementations/Migrations/JellyfinDbModelSnapshot.cs | 186 |
3 files changed, 408 insertions, 168 deletions
diff --git a/Jellyfin.Server.Implementations/Migrations/20200504195702_UserSchema.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20200517002411_AddUsers.Designer.cs index 8313c6a3b7..36c58c8ca2 100644 --- a/Jellyfin.Server.Implementations/Migrations/20200504195702_UserSchema.Designer.cs +++ b/Jellyfin.Server.Implementations/Migrations/20200517002411_AddUsers.Designer.cs @@ -1,4 +1,4 @@ -#pragma warning disable CS1591 +#pragma warning disable CS1591 #pragma warning disable SA1601 // <auto-generated /> @@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace Jellyfin.Server.Implementations.Migrations { [DbContext(typeof(JellyfinDb))] - [Migration("20200504195702_UserSchema")] - partial class UserSchema + [Migration("20200517002411_AddUsers")] + partial class AddUsers { protected override void BuildTargetModel(ModelBuilder modelBuilder) { @@ -22,6 +22,31 @@ namespace Jellyfin.Server.Implementations.Migrations .HasDefaultSchema("jellyfin") .HasAnnotation("ProductVersion", "3.1.3"); + modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property<int>("DayOfWeek") + .HasColumnType("INTEGER"); + + b.Property<double>("EndHour") + .HasColumnType("REAL"); + + b.Property<double>("StartHour") + .HasColumnType("REAL"); + + b.Property<Guid>("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AccessSchedule"); + }); + modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => { b.Property<int>("Id") @@ -65,17 +90,17 @@ namespace Jellyfin.Server.Implementations.Migrations b.HasKey("Id"); - b.ToTable("ActivityLog"); + b.ToTable("ActivityLogs"); }); modelBuilder.Entity("Jellyfin.Data.Entities.Group", b => { - b.Property<int>("Id") + b.Property<Guid>("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("TEXT"); - b.Property<int?>("Group_Groups_Id") - .HasColumnType("INTEGER"); + b.Property<Guid?>("Group_Groups_Guid") + .HasColumnType("TEXT"); b.Property<string>("Name") .IsRequired() @@ -88,9 +113,27 @@ namespace Jellyfin.Server.Implementations.Migrations b.HasKey("Id"); - b.HasIndex("Group_Groups_Id"); + b.HasIndex("Group_Groups_Guid"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.ToTable("Group"); + b.Property<DateTime>("LastModified") + .HasColumnType("TEXT"); + + b.Property<string>("Path") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("ImageInfo"); }); modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => @@ -102,11 +145,11 @@ namespace Jellyfin.Server.Implementations.Migrations b.Property<int>("Kind") .HasColumnType("INTEGER"); - b.Property<int?>("Permission_GroupPermissions_Id") - .HasColumnType("INTEGER"); + b.Property<Guid?>("Permission_GroupPermissions_Id") + .HasColumnType("TEXT"); - b.Property<int?>("Permission_Permissions_Id") - .HasColumnType("INTEGER"); + b.Property<Guid?>("Permission_Permissions_Guid") + .HasColumnType("TEXT"); b.Property<uint>("RowVersion") .IsConcurrencyToken() @@ -119,9 +162,9 @@ namespace Jellyfin.Server.Implementations.Migrations b.HasIndex("Permission_GroupPermissions_Id"); - b.HasIndex("Permission_Permissions_Id"); + b.HasIndex("Permission_Permissions_Guid"); - b.ToTable("Permission"); + b.ToTable("Permissions"); }); modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => @@ -133,8 +176,11 @@ namespace Jellyfin.Server.Implementations.Migrations b.Property<int>("Kind") .HasColumnType("INTEGER"); - b.Property<int?>("Preference_Preferences_Id") - .HasColumnType("INTEGER"); + b.Property<Guid?>("Preference_Preferences_Guid") + .HasColumnType("TEXT"); + + b.Property<Guid?>("Preference_Preferences_Id") + .HasColumnType("TEXT"); b.Property<uint>("RowVersion") .IsConcurrencyToken() @@ -147,9 +193,11 @@ namespace Jellyfin.Server.Implementations.Migrations b.HasKey("Id"); + b.HasIndex("Preference_Preferences_Guid"); + b.HasIndex("Preference_Preferences_Id"); - b.ToTable("Preference"); + b.ToTable("Preferences"); }); modelBuilder.Entity("Jellyfin.Data.Entities.ProviderMapping", b => @@ -163,8 +211,8 @@ namespace Jellyfin.Server.Implementations.Migrations .HasColumnType("TEXT") .HasMaxLength(65535); - b.Property<int?>("ProviderMapping_ProviderMappings_Id") - .HasColumnType("INTEGER"); + b.Property<Guid?>("ProviderMapping_ProviderMappings_Id") + .HasColumnType("TEXT"); b.Property<string>("ProviderName") .IsRequired() @@ -189,12 +237,11 @@ namespace Jellyfin.Server.Implementations.Migrations modelBuilder.Entity("Jellyfin.Data.Entities.User", b => { - b.Property<int>("Id") + b.Property<Guid>("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("TEXT"); b.Property<string>("AudioLanguagePreference") - .IsRequired() .HasColumnType("TEXT") .HasMaxLength(255); @@ -203,71 +250,86 @@ namespace Jellyfin.Server.Implementations.Migrations .HasColumnType("TEXT") .HasMaxLength(255); - b.Property<bool?>("DisplayCollectionsView") + b.Property<bool>("DisplayCollectionsView") .HasColumnType("INTEGER"); - b.Property<bool?>("DisplayMissingEpisodes") + b.Property<bool>("DisplayMissingEpisodes") .HasColumnType("INTEGER"); - b.Property<bool?>("EnableNextEpisodeAutoPlay") + b.Property<string>("EasyPassword") + .HasColumnType("TEXT") + .HasMaxLength(65535); + + b.Property<bool>("EnableAutoLogin") .HasColumnType("INTEGER"); - b.Property<bool?>("EnableUserPreferenceAccess") + b.Property<bool>("EnableLocalPassword") .HasColumnType("INTEGER"); - b.Property<string>("GroupedFolders") - .HasColumnType("TEXT") - .HasMaxLength(65535); + b.Property<bool>("EnableNextEpisodeAutoPlay") + .HasColumnType("INTEGER"); - b.Property<bool?>("HidePlayedInLatest") + b.Property<bool>("EnableUserPreferenceAccess") + .HasColumnType("INTEGER"); + + b.Property<bool>("HidePlayedInLatest") + .HasColumnType("INTEGER"); + + b.Property<long>("InternalId") .HasColumnType("INTEGER"); b.Property<int>("InvalidLoginAttemptCount") .HasColumnType("INTEGER"); - b.Property<string>("LatestItemExcludes") - .HasColumnType("TEXT") - .HasMaxLength(65535); + b.Property<DateTime>("LastActivityDate") + .HasColumnType("TEXT"); + + b.Property<DateTime>("LastLoginDate") + .HasColumnType("TEXT"); b.Property<int?>("LoginAttemptsBeforeLockout") .HasColumnType("INTEGER"); - b.Property<bool>("MustUpdatePassword") + b.Property<int?>("MaxParentalAgeRating") .HasColumnType("INTEGER"); - b.Property<string>("MyMediaExcludes") - .HasColumnType("TEXT") - .HasMaxLength(65535); + b.Property<bool>("MustUpdatePassword") + .HasColumnType("INTEGER"); - b.Property<string>("OrderedViews") + b.Property<string>("Password") .HasColumnType("TEXT") .HasMaxLength(65535); - b.Property<string>("Password") + b.Property<string>("PasswordResetProviderId") + .IsRequired() .HasColumnType("TEXT") - .HasMaxLength(65535); + .HasMaxLength(255); b.Property<bool>("PlayDefaultAudioTrack") .HasColumnType("INTEGER"); - b.Property<bool?>("RememberAudioSelections") + b.Property<int?>("ProfileImageId") + .HasColumnType("INTEGER"); + + b.Property<bool>("RememberAudioSelections") .HasColumnType("INTEGER"); - b.Property<bool?>("RememberSubtitleSelections") + b.Property<bool>("RememberSubtitleSelections") + .HasColumnType("INTEGER"); + + b.Property<int?>("RemoteClientBitrateLimit") .HasColumnType("INTEGER"); b.Property<uint>("RowVersion") .IsConcurrencyToken() .HasColumnType("INTEGER"); - b.Property<string>("SubtitleLanguagePrefernce") + b.Property<string>("SubtitleLanguagePreference") .HasColumnType("TEXT") .HasMaxLength(255); - b.Property<string>("SubtitleMode") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(255); + b.Property<int>("SubtitleMode") + .HasColumnType("INTEGER"); b.Property<string>("Username") .IsRequired() @@ -276,34 +338,45 @@ namespace Jellyfin.Server.Implementations.Migrations b.HasKey("Id"); - b.ToTable("User"); + b.HasIndex("ProfileImageId"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => + { + b.HasOne("Jellyfin.Data.Entities.User", null) + .WithMany("AccessSchedules") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Jellyfin.Data.Entities.Group", b => { b.HasOne("Jellyfin.Data.Entities.User", null) .WithMany("Groups") - .HasForeignKey("Group_Groups_Id"); + .HasForeignKey("Group_Groups_Guid"); }); modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => { b.HasOne("Jellyfin.Data.Entities.Group", null) - .WithMany("GroupPermissions") + .WithMany("Permissions") .HasForeignKey("Permission_GroupPermissions_Id"); b.HasOne("Jellyfin.Data.Entities.User", null) .WithMany("Permissions") - .HasForeignKey("Permission_Permissions_Id"); + .HasForeignKey("Permission_Permissions_Guid"); }); modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => { - b.HasOne("Jellyfin.Data.Entities.Group", null) + b.HasOne("Jellyfin.Data.Entities.User", null) .WithMany("Preferences") - .HasForeignKey("Preference_Preferences_Id"); + .HasForeignKey("Preference_Preferences_Guid"); - b.HasOne("Jellyfin.Data.Entities.User", null) + b.HasOne("Jellyfin.Data.Entities.Group", null) .WithMany("Preferences") .HasForeignKey("Preference_Preferences_Id"); }); @@ -318,6 +391,13 @@ namespace Jellyfin.Server.Implementations.Migrations .WithMany("ProviderMappings") .HasForeignKey("ProviderMapping_ProviderMappings_Id"); }); + + modelBuilder.Entity("Jellyfin.Data.Entities.User", b => + { + b.HasOne("Jellyfin.Data.Entities.ImageInfo", "ProfileImage") + .WithMany() + .HasForeignKey("ProfileImageId"); + }); #pragma warning restore 612, 618 } } diff --git a/Jellyfin.Server.Implementations/Migrations/20200504195702_UserSchema.cs b/Jellyfin.Server.Implementations/Migrations/20200517002411_AddUsers.cs index f24ccccbf6..55c6f371c0 100644 --- a/Jellyfin.Server.Implementations/Migrations/20200504195702_UserSchema.cs +++ b/Jellyfin.Server.Implementations/Migrations/20200517002411_AddUsers.cs @@ -1,74 +1,125 @@ -#pragma warning disable CS1591 +#pragma warning disable CS1591 #pragma warning disable SA1601 +using System; using Microsoft.EntityFrameworkCore.Migrations; namespace Jellyfin.Server.Implementations.Migrations { - public partial class UserSchema : Migration + public partial class AddUsers : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( - name: "User", + name: "ImageInfo", schema: "jellyfin", columns: table => new { Id = table.Column<int>(nullable: false) .Annotation("Sqlite:Autoincrement", true), + Path = table.Column<string>(nullable: false), + LastModified = table.Column<DateTime>(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ImageInfo", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Users", + schema: "jellyfin", + columns: table => new + { + Id = table.Column<Guid>(nullable: false), Username = table.Column<string>(maxLength: 255, nullable: false), Password = table.Column<string>(maxLength: 65535, nullable: true), + EasyPassword = table.Column<string>(maxLength: 65535, nullable: true), MustUpdatePassword = table.Column<bool>(nullable: false), - AudioLanguagePreference = table.Column<string>(maxLength: 255, nullable: false), + AudioLanguagePreference = table.Column<string>(maxLength: 255, nullable: true), AuthenticationProviderId = table.Column<string>(maxLength: 255, nullable: false), - GroupedFolders = table.Column<string>(maxLength: 65535, nullable: true), + PasswordResetProviderId = table.Column<string>(maxLength: 255, nullable: false), InvalidLoginAttemptCount = table.Column<int>(nullable: false), - LatestItemExcludes = table.Column<string>(maxLength: 65535, nullable: true), + LastActivityDate = table.Column<DateTime>(nullable: false), + LastLoginDate = table.Column<DateTime>(nullable: false), LoginAttemptsBeforeLockout = table.Column<int>(nullable: true), - MyMediaExcludes = table.Column<string>(maxLength: 65535, nullable: true), - OrderedViews = table.Column<string>(maxLength: 65535, nullable: true), - SubtitleMode = table.Column<string>(maxLength: 255, nullable: false), + SubtitleMode = table.Column<int>(nullable: false), PlayDefaultAudioTrack = table.Column<bool>(nullable: false), - SubtitleLanguagePrefernce = table.Column<string>(maxLength: 255, nullable: true), - DisplayMissingEpisodes = table.Column<bool>(nullable: true), - DisplayCollectionsView = table.Column<bool>(nullable: true), - HidePlayedInLatest = table.Column<bool>(nullable: true), - RememberAudioSelections = table.Column<bool>(nullable: true), - RememberSubtitleSelections = table.Column<bool>(nullable: true), - EnableNextEpisodeAutoPlay = table.Column<bool>(nullable: true), - EnableUserPreferenceAccess = table.Column<bool>(nullable: true), + SubtitleLanguagePreference = table.Column<string>(maxLength: 255, nullable: true), + DisplayMissingEpisodes = table.Column<bool>(nullable: false), + DisplayCollectionsView = table.Column<bool>(nullable: false), + EnableLocalPassword = table.Column<bool>(nullable: false), + HidePlayedInLatest = table.Column<bool>(nullable: false), + RememberAudioSelections = table.Column<bool>(nullable: false), + RememberSubtitleSelections = table.Column<bool>(nullable: false), + EnableNextEpisodeAutoPlay = table.Column<bool>(nullable: false), + EnableAutoLogin = table.Column<bool>(nullable: false), + EnableUserPreferenceAccess = table.Column<bool>(nullable: false), + MaxParentalAgeRating = table.Column<int>(nullable: true), + RemoteClientBitrateLimit = table.Column<int>(nullable: true), + InternalId = table.Column<long>(nullable: false), + ProfileImageId = table.Column<int>(nullable: true), RowVersion = table.Column<uint>(nullable: false) }, constraints: table => { - table.PrimaryKey("PK_User", x => x.Id); + table.PrimaryKey("PK_Users", x => x.Id); + table.ForeignKey( + name: "FK_Users_ImageInfo_ProfileImageId", + column: x => x.ProfileImageId, + principalSchema: "jellyfin", + principalTable: "ImageInfo", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( - name: "Group", + name: "AccessSchedule", schema: "jellyfin", columns: table => new { Id = table.Column<int>(nullable: false) .Annotation("Sqlite:Autoincrement", true), + UserId = table.Column<Guid>(nullable: false), + DayOfWeek = table.Column<int>(nullable: false), + StartHour = table.Column<double>(nullable: false), + EndHour = table.Column<double>(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AccessSchedule", x => x.Id); + table.ForeignKey( + name: "FK_AccessSchedule_Users_UserId", + column: x => x.UserId, + principalSchema: "jellyfin", + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Groups", + schema: "jellyfin", + columns: table => new + { + Id = table.Column<Guid>(nullable: false), Name = table.Column<string>(maxLength: 255, nullable: false), RowVersion = table.Column<uint>(nullable: false), - Group_Groups_Id = table.Column<int>(nullable: true) + Group_Groups_Guid = table.Column<Guid>(nullable: true) }, constraints: table => { - table.PrimaryKey("PK_Group", x => x.Id); + table.PrimaryKey("PK_Groups", x => x.Id); table.ForeignKey( - name: "FK_Group_User_Group_Groups_Id", - column: x => x.Group_Groups_Id, + name: "FK_Groups_Users_Group_Groups_Guid", + column: x => x.Group_Groups_Guid, principalSchema: "jellyfin", - principalTable: "User", + principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( - name: "Permission", + name: "Permissions", schema: "jellyfin", columns: table => new { @@ -77,30 +128,30 @@ namespace Jellyfin.Server.Implementations.Migrations Kind = table.Column<int>(nullable: false), Value = table.Column<bool>(nullable: false), RowVersion = table.Column<uint>(nullable: false), - Permission_GroupPermissions_Id = table.Column<int>(nullable: true), - Permission_Permissions_Id = table.Column<int>(nullable: true) + Permission_GroupPermissions_Id = table.Column<Guid>(nullable: true), + Permission_Permissions_Guid = table.Column<Guid>(nullable: true) }, constraints: table => { - table.PrimaryKey("PK_Permission", x => x.Id); + table.PrimaryKey("PK_Permissions", x => x.Id); table.ForeignKey( - name: "FK_Permission_Group_Permission_GroupPermissions_Id", + name: "FK_Permissions_Groups_Permission_GroupPermissions_Id", column: x => x.Permission_GroupPermissions_Id, principalSchema: "jellyfin", - principalTable: "Group", + principalTable: "Groups", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( - name: "FK_Permission_User_Permission_Permissions_Id", - column: x => x.Permission_Permissions_Id, + name: "FK_Permissions_Users_Permission_Permissions_Guid", + column: x => x.Permission_Permissions_Guid, principalSchema: "jellyfin", - principalTable: "User", + principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( - name: "Preference", + name: "Preferences", schema: "jellyfin", columns: table => new { @@ -109,23 +160,24 @@ namespace Jellyfin.Server.Implementations.Migrations Kind = table.Column<int>(nullable: false), Value = table.Column<string>(maxLength: 65535, nullable: false), RowVersion = table.Column<uint>(nullable: false), - Preference_Preferences_Id = table.Column<int>(nullable: true) + Preference_Preferences_Guid = table.Column<Guid>(nullable: true), + Preference_Preferences_Id = table.Column<Guid>(nullable: true) }, constraints: table => { - table.PrimaryKey("PK_Preference", x => x.Id); + table.PrimaryKey("PK_Preferences", x => x.Id); table.ForeignKey( - name: "FK_Preference_Group_Preference_Preferences_Id", - column: x => x.Preference_Preferences_Id, + name: "FK_Preferences_Users_Preference_Preferences_Guid", + column: x => x.Preference_Preferences_Guid, principalSchema: "jellyfin", - principalTable: "Group", + principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( - name: "FK_Preference_User_Preference_Preferences_Id", + name: "FK_Preferences_Groups_Preference_Preferences_Id", column: x => x.Preference_Preferences_Id, principalSchema: "jellyfin", - principalTable: "User", + principalTable: "Groups", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); @@ -141,49 +193,61 @@ namespace Jellyfin.Server.Implementations.Migrations ProviderSecrets = table.Column<string>(maxLength: 65535, nullable: false), ProviderData = table.Column<string>(maxLength: 65535, nullable: false), RowVersion = table.Column<uint>(nullable: false), - ProviderMapping_ProviderMappings_Id = table.Column<int>(nullable: true) + ProviderMapping_ProviderMappings_Id = table.Column<Guid>(nullable: true) }, constraints: table => { table.PrimaryKey("PK_ProviderMapping", x => x.Id); table.ForeignKey( - name: "FK_ProviderMapping_Group_ProviderMapping_ProviderMappings_Id", + name: "FK_ProviderMapping_Groups_ProviderMapping_ProviderMappings_Id", column: x => x.ProviderMapping_ProviderMappings_Id, principalSchema: "jellyfin", - principalTable: "Group", + principalTable: "Groups", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( - name: "FK_ProviderMapping_User_ProviderMapping_ProviderMappings_Id", + name: "FK_ProviderMapping_Users_ProviderMapping_ProviderMappings_Id", column: x => x.ProviderMapping_ProviderMappings_Id, principalSchema: "jellyfin", - principalTable: "User", + principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( - name: "IX_Group_Group_Groups_Id", + name: "IX_AccessSchedule_UserId", schema: "jellyfin", - table: "Group", - column: "Group_Groups_Id"); + table: "AccessSchedule", + column: "UserId"); migrationBuilder.CreateIndex( - name: "IX_Permission_Permission_GroupPermissions_Id", + name: "IX_Groups_Group_Groups_Guid", schema: "jellyfin", - table: "Permission", + table: "Groups", + column: "Group_Groups_Guid"); + + migrationBuilder.CreateIndex( + name: "IX_Permissions_Permission_GroupPermissions_Id", + schema: "jellyfin", + table: "Permissions", column: "Permission_GroupPermissions_Id"); migrationBuilder.CreateIndex( - name: "IX_Permission_Permission_Permissions_Id", + name: "IX_Permissions_Permission_Permissions_Guid", + schema: "jellyfin", + table: "Permissions", + column: "Permission_Permissions_Guid"); + + migrationBuilder.CreateIndex( + name: "IX_Preferences_Preference_Preferences_Guid", schema: "jellyfin", - table: "Permission", - column: "Permission_Permissions_Id"); + table: "Preferences", + column: "Preference_Preferences_Guid"); migrationBuilder.CreateIndex( - name: "IX_Preference_Preference_Preferences_Id", + name: "IX_Preferences_Preference_Preferences_Id", schema: "jellyfin", - table: "Preference", + table: "Preferences", column: "Preference_Preferences_Id"); migrationBuilder.CreateIndex( @@ -191,16 +255,26 @@ namespace Jellyfin.Server.Implementations.Migrations schema: "jellyfin", table: "ProviderMapping", column: "ProviderMapping_ProviderMappings_Id"); + + migrationBuilder.CreateIndex( + name: "IX_Users_ProfileImageId", + schema: "jellyfin", + table: "Users", + column: "ProfileImageId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( - name: "Permission", + name: "AccessSchedule", + schema: "jellyfin"); + + migrationBuilder.DropTable( + name: "Permissions", schema: "jellyfin"); migrationBuilder.DropTable( - name: "Preference", + name: "Preferences", schema: "jellyfin"); migrationBuilder.DropTable( @@ -208,11 +282,15 @@ namespace Jellyfin.Server.Implementations.Migrations schema: "jellyfin"); migrationBuilder.DropTable( - name: "Group", + name: "Groups", + schema: "jellyfin"); + + migrationBuilder.DropTable( + name: "Users", schema: "jellyfin"); migrationBuilder.DropTable( - name: "User", + name: "ImageInfo", schema: "jellyfin"); } } diff --git a/Jellyfin.Server.Implementations/Migrations/JellyfinDbModelSnapshot.cs b/Jellyfin.Server.Implementations/Migrations/JellyfinDbModelSnapshot.cs index 0fb0ba8033..46714e8659 100644 --- a/Jellyfin.Server.Implementations/Migrations/JellyfinDbModelSnapshot.cs +++ b/Jellyfin.Server.Implementations/Migrations/JellyfinDbModelSnapshot.cs @@ -1,7 +1,9 @@ // <auto-generated /> using System; +using Jellyfin.Server.Implementations; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace Jellyfin.Server.Implementations.Migrations { @@ -15,6 +17,31 @@ namespace Jellyfin.Server.Implementations.Migrations .HasDefaultSchema("jellyfin") .HasAnnotation("ProductVersion", "3.1.3"); + modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property<int>("DayOfWeek") + .HasColumnType("INTEGER"); + + b.Property<double>("EndHour") + .HasColumnType("REAL"); + + b.Property<double>("StartHour") + .HasColumnType("REAL"); + + b.Property<Guid>("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AccessSchedule"); + }); + modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b => { b.Property<int>("Id") @@ -63,12 +90,12 @@ namespace Jellyfin.Server.Implementations.Migrations modelBuilder.Entity("Jellyfin.Data.Entities.Group", b => { - b.Property<int>("Id") + b.Property<Guid>("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("TEXT"); - b.Property<int?>("Group_Groups_Id") - .HasColumnType("INTEGER"); + b.Property<Guid?>("Group_Groups_Guid") + .HasColumnType("TEXT"); b.Property<string>("Name") .IsRequired() @@ -81,9 +108,27 @@ namespace Jellyfin.Server.Implementations.Migrations b.HasKey("Id"); - b.HasIndex("Group_Groups_Id"); + b.HasIndex("Group_Groups_Guid"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.ToTable("Group"); + b.Property<DateTime>("LastModified") + .HasColumnType("TEXT"); + + b.Property<string>("Path") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("ImageInfo"); }); modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => @@ -95,11 +140,11 @@ namespace Jellyfin.Server.Implementations.Migrations b.Property<int>("Kind") .HasColumnType("INTEGER"); - b.Property<int?>("Permission_GroupPermissions_Id") - .HasColumnType("INTEGER"); + b.Property<Guid?>("Permission_GroupPermissions_Id") + .HasColumnType("TEXT"); - b.Property<int?>("Permission_Permissions_Id") - .HasColumnType("INTEGER"); + b.Property<Guid?>("Permission_Permissions_Guid") + .HasColumnType("TEXT"); b.Property<uint>("RowVersion") .IsConcurrencyToken() @@ -112,9 +157,9 @@ namespace Jellyfin.Server.Implementations.Migrations b.HasIndex("Permission_GroupPermissions_Id"); - b.HasIndex("Permission_Permissions_Id"); + b.HasIndex("Permission_Permissions_Guid"); - b.ToTable("Permission"); + b.ToTable("Permissions"); }); modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => @@ -126,8 +171,11 @@ namespace Jellyfin.Server.Implementations.Migrations b.Property<int>("Kind") .HasColumnType("INTEGER"); - b.Property<int?>("Preference_Preferences_Id") - .HasColumnType("INTEGER"); + b.Property<Guid?>("Preference_Preferences_Guid") + .HasColumnType("TEXT"); + + b.Property<Guid?>("Preference_Preferences_Id") + .HasColumnType("TEXT"); b.Property<uint>("RowVersion") .IsConcurrencyToken() @@ -140,9 +188,11 @@ namespace Jellyfin.Server.Implementations.Migrations b.HasKey("Id"); + b.HasIndex("Preference_Preferences_Guid"); + b.HasIndex("Preference_Preferences_Id"); - b.ToTable("Preference"); + b.ToTable("Preferences"); }); modelBuilder.Entity("Jellyfin.Data.Entities.ProviderMapping", b => @@ -156,8 +206,8 @@ namespace Jellyfin.Server.Implementations.Migrations .HasColumnType("TEXT") .HasMaxLength(65535); - b.Property<int?>("ProviderMapping_ProviderMappings_Id") - .HasColumnType("INTEGER"); + b.Property<Guid?>("ProviderMapping_ProviderMappings_Id") + .HasColumnType("TEXT"); b.Property<string>("ProviderName") .IsRequired() @@ -182,12 +232,11 @@ namespace Jellyfin.Server.Implementations.Migrations modelBuilder.Entity("Jellyfin.Data.Entities.User", b => { - b.Property<int>("Id") + b.Property<Guid>("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("TEXT"); b.Property<string>("AudioLanguagePreference") - .IsRequired() .HasColumnType("TEXT") .HasMaxLength(255); @@ -196,71 +245,86 @@ namespace Jellyfin.Server.Implementations.Migrations .HasColumnType("TEXT") .HasMaxLength(255); - b.Property<bool?>("DisplayCollectionsView") + b.Property<bool>("DisplayCollectionsView") .HasColumnType("INTEGER"); - b.Property<bool?>("DisplayMissingEpisodes") + b.Property<bool>("DisplayMissingEpisodes") .HasColumnType("INTEGER"); - b.Property<bool?>("EnableNextEpisodeAutoPlay") + b.Property<string>("EasyPassword") + .HasColumnType("TEXT") + .HasMaxLength(65535); + + b.Property<bool>("EnableAutoLogin") .HasColumnType("INTEGER"); - b.Property<bool?>("EnableUserPreferenceAccess") + b.Property<bool>("EnableLocalPassword") .HasColumnType("INTEGER"); - b.Property<string>("GroupedFolders") - .HasColumnType("TEXT") - .HasMaxLength(65535); + b.Property<bool>("EnableNextEpisodeAutoPlay") + .HasColumnType("INTEGER"); - b.Property<bool?>("HidePlayedInLatest") + b.Property<bool>("EnableUserPreferenceAccess") + .HasColumnType("INTEGER"); + + b.Property<bool>("HidePlayedInLatest") + .HasColumnType("INTEGER"); + + b.Property<long>("InternalId") .HasColumnType("INTEGER"); b.Property<int>("InvalidLoginAttemptCount") .HasColumnType("INTEGER"); - b.Property<string>("LatestItemExcludes") - .HasColumnType("TEXT") - .HasMaxLength(65535); + b.Property<DateTime>("LastActivityDate") + .HasColumnType("TEXT"); + + b.Property<DateTime>("LastLoginDate") + .HasColumnType("TEXT"); b.Property<int?>("LoginAttemptsBeforeLockout") .HasColumnType("INTEGER"); - b.Property<bool>("MustUpdatePassword") + b.Property<int?>("MaxParentalAgeRating") .HasColumnType("INTEGER"); - b.Property<string>("MyMediaExcludes") - .HasColumnType("TEXT") - .HasMaxLength(65535); + b.Property<bool>("MustUpdatePassword") + .HasColumnType("INTEGER"); - b.Property<string>("OrderedViews") + b.Property<string>("Password") .HasColumnType("TEXT") .HasMaxLength(65535); - b.Property<string>("Password") + b.Property<string>("PasswordResetProviderId") + .IsRequired() .HasColumnType("TEXT") - .HasMaxLength(65535); + .HasMaxLength(255); b.Property<bool>("PlayDefaultAudioTrack") .HasColumnType("INTEGER"); - b.Property<bool?>("RememberAudioSelections") + b.Property<int?>("ProfileImageId") + .HasColumnType("INTEGER"); + + b.Property<bool>("RememberAudioSelections") .HasColumnType("INTEGER"); - b.Property<bool?>("RememberSubtitleSelections") + b.Property<bool>("RememberSubtitleSelections") + .HasColumnType("INTEGER"); + + b.Property<int?>("RemoteClientBitrateLimit") .HasColumnType("INTEGER"); b.Property<uint>("RowVersion") .IsConcurrencyToken() .HasColumnType("INTEGER"); - b.Property<string>("SubtitleLanguagePrefernce") + b.Property<string>("SubtitleLanguagePreference") .HasColumnType("TEXT") .HasMaxLength(255); - b.Property<string>("SubtitleMode") - .IsRequired() - .HasColumnType("TEXT") - .HasMaxLength(255); + b.Property<int>("SubtitleMode") + .HasColumnType("INTEGER"); b.Property<string>("Username") .IsRequired() @@ -269,34 +333,45 @@ namespace Jellyfin.Server.Implementations.Migrations b.HasKey("Id"); - b.ToTable("User"); + b.HasIndex("ProfileImageId"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b => + { + b.HasOne("Jellyfin.Data.Entities.User", null) + .WithMany("AccessSchedules") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Jellyfin.Data.Entities.Group", b => { b.HasOne("Jellyfin.Data.Entities.User", null) .WithMany("Groups") - .HasForeignKey("Group_Groups_Id"); + .HasForeignKey("Group_Groups_Guid"); }); modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b => { b.HasOne("Jellyfin.Data.Entities.Group", null) - .WithMany("GroupPermissions") + .WithMany("Permissions") .HasForeignKey("Permission_GroupPermissions_Id"); b.HasOne("Jellyfin.Data.Entities.User", null) .WithMany("Permissions") - .HasForeignKey("Permission_Permissions_Id"); + .HasForeignKey("Permission_Permissions_Guid"); }); modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b => { - b.HasOne("Jellyfin.Data.Entities.Group", null) + b.HasOne("Jellyfin.Data.Entities.User", null) .WithMany("Preferences") - .HasForeignKey("Preference_Preferences_Id"); + .HasForeignKey("Preference_Preferences_Guid"); - b.HasOne("Jellyfin.Data.Entities.User", null) + b.HasOne("Jellyfin.Data.Entities.Group", null) .WithMany("Preferences") .HasForeignKey("Preference_Preferences_Id"); }); @@ -311,6 +386,13 @@ namespace Jellyfin.Server.Implementations.Migrations .WithMany("ProviderMappings") .HasForeignKey("ProviderMapping_ProviderMappings_Id"); }); + + modelBuilder.Entity("Jellyfin.Data.Entities.User", b => + { + b.HasOne("Jellyfin.Data.Entities.ImageInfo", "ProfileImage") + .WithMany() + .HasForeignKey("ProfileImageId"); + }); #pragma warning restore 612, 618 } } |
