Remove unused portions of the user schema

This commit is contained in:
Patrick Barron 2020-05-30 22:11:53 -04:00
parent e72fd88913
commit 63344ec5fd
6 changed files with 17 additions and 313 deletions

View File

@ -43,12 +43,6 @@ namespace Jellyfin.Data.Entities
if (string.IsNullOrEmpty(providerdata)) throw new ArgumentNullException(nameof(providerdata));
this.ProviderData = providerdata;
if (_user0 == null) throw new ArgumentNullException(nameof(_user0));
_user0.ProviderMappings.Add(this);
if (_group1 == null) throw new ArgumentNullException(nameof(_group1));
_group1.ProviderMappings.Add(this);
Init();
}

View File

@ -47,11 +47,11 @@ namespace Jellyfin.Data.Entities
AuthenticationProviderId = authenticationProviderId;
PasswordResetProviderId = passwordResetProviderId;
Groups = new HashSet<Group>();
Permissions = new HashSet<Permission>();
ProviderMappings = new HashSet<ProviderMapping>();
Preferences = new HashSet<Preference>();
AccessSchedules = new HashSet<AccessSchedule>();
// Groups = new HashSet<Group>();
Permissions = new HashSet<Permission>();
Preferences = new HashSet<Preference>();
// ProviderMappings = new HashSet<ProviderMapping>();
// Set default values
Id = Guid.NewGuid();
@ -342,11 +342,18 @@ namespace Jellyfin.Data.Entities
* Navigation properties
*************************************************************************/
/// <summary>
/// Gets or sets the list of access schedules this user has.
/// </summary>
public virtual ICollection<AccessSchedule> AccessSchedules { get; protected set; }
/*
/// <summary>
/// Gets or sets the list of groups this user is a member of.
/// </summary>
[ForeignKey("Group_Groups_Guid")]
public virtual ICollection<Group> Groups { get; protected set; }
*/
/// <summary>
/// Gets or sets the list of permissions this user has.
@ -354,11 +361,13 @@ namespace Jellyfin.Data.Entities
[ForeignKey("Permission_Permissions_Guid")]
public virtual ICollection<Permission> Permissions { get; protected set; }
/*
/// <summary>
/// Gets or sets the list of provider mappings this user has.
/// </summary>
[ForeignKey("ProviderMapping_ProviderMappings_Id")]
public virtual ICollection<ProviderMapping> ProviderMappings { get; protected set; }
*/
/// <summary>
/// Gets or sets the list of preferences this user has.
@ -366,11 +375,6 @@ namespace Jellyfin.Data.Entities
[ForeignKey("Preference_Preferences_Guid")]
public virtual ICollection<Preference> Preferences { get; protected set; }
/// <summary>
/// Gets or sets the list of access schedules this user has.
/// </summary>
public virtual ICollection<AccessSchedule> AccessSchedules { get; protected set; }
/// <summary>
/// Static create function (for use in LINQ queries, etc.)
/// </summary>

View File

@ -25,8 +25,6 @@ namespace Jellyfin.Server.Implementations
public virtual DbSet<ActivityLog> ActivityLogs { get; set; }
public virtual DbSet<Group> Groups { get; set; }
public virtual DbSet<Permission> Permissions { get; set; }
public virtual DbSet<Preference> Preferences { get; set; }
@ -45,6 +43,7 @@ namespace Jellyfin.Server.Implementations
public virtual DbSet<Episode> Episodes { get; set; }
public virtual DbSet<EpisodeMetadata> EpisodeMetadata { get; set; }
public virtual DbSet<Genre> Genres { get; set; }
public virtual DbSet<Group> Groups { get; set; }
public virtual DbSet<Library> Libraries { get; set; }
public virtual DbSet<LibraryItem> LibraryItems { get; set; }
public virtual DbSet<LibraryRoot> LibraryRoot { get; set; }

View File

@ -1,4 +1,5 @@
#pragma warning disable CS1591
#pragma warning disable SA1601
// <auto-generated />
using System;
@ -11,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Jellyfin.Server.Implementations.Migrations
{
[DbContext(typeof(JellyfinDb))]
[Migration("20200529171409_AddUsers")]
[Migration("20200531020729_AddUsers")]
partial class AddUsers
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -92,31 +93,6 @@ namespace Jellyfin.Server.Implementations.Migrations
b.ToTable("ActivityLogs");
});
modelBuilder.Entity("Jellyfin.Data.Entities.Group", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<Guid?>("Group_Groups_Guid")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(255);
b.Property<uint>("RowVersion")
.IsConcurrencyToken()
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Group_Groups_Guid");
b.ToTable("Groups");
});
modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b =>
{
b.Property<int>("Id")
@ -145,9 +121,6 @@ namespace Jellyfin.Server.Implementations.Migrations
b.Property<int>("Kind")
.HasColumnType("INTEGER");
b.Property<Guid?>("Permission_GroupPermissions_Id")
.HasColumnType("TEXT");
b.Property<Guid?>("Permission_Permissions_Guid")
.HasColumnType("TEXT");
@ -160,8 +133,6 @@ namespace Jellyfin.Server.Implementations.Migrations
b.HasKey("Id");
b.HasIndex("Permission_GroupPermissions_Id");
b.HasIndex("Permission_Permissions_Guid");
b.ToTable("Permissions");
@ -179,9 +150,6 @@ namespace Jellyfin.Server.Implementations.Migrations
b.Property<Guid?>("Preference_Preferences_Guid")
.HasColumnType("TEXT");
b.Property<Guid?>("Preference_Preferences_Id")
.HasColumnType("TEXT");
b.Property<uint>("RowVersion")
.IsConcurrencyToken()
.HasColumnType("INTEGER");
@ -195,46 +163,9 @@ namespace Jellyfin.Server.Implementations.Migrations
b.HasIndex("Preference_Preferences_Guid");
b.HasIndex("Preference_Preferences_Id");
b.ToTable("Preferences");
});
modelBuilder.Entity("Jellyfin.Data.Entities.ProviderMapping", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ProviderData")
.IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(65535);
b.Property<Guid?>("ProviderMapping_ProviderMappings_Id")
.HasColumnType("TEXT");
b.Property<string>("ProviderName")
.IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(255);
b.Property<string>("ProviderSecrets")
.IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(65535);
b.Property<uint>("RowVersion")
.IsConcurrencyToken()
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ProviderMapping_ProviderMappings_Id");
b.ToTable("ProviderMapping");
});
modelBuilder.Entity("Jellyfin.Data.Entities.User", b =>
{
b.Property<Guid>("Id")
@ -355,19 +286,8 @@ namespace Jellyfin.Server.Implementations.Migrations
.IsRequired();
});
modelBuilder.Entity("Jellyfin.Data.Entities.Group", b =>
{
b.HasOne("Jellyfin.Data.Entities.User", null)
.WithMany("Groups")
.HasForeignKey("Group_Groups_Guid");
});
modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b =>
{
b.HasOne("Jellyfin.Data.Entities.Group", null)
.WithMany("Permissions")
.HasForeignKey("Permission_GroupPermissions_Id");
b.HasOne("Jellyfin.Data.Entities.User", null)
.WithMany("Permissions")
.HasForeignKey("Permission_Permissions_Guid");
@ -378,21 +298,6 @@ namespace Jellyfin.Server.Implementations.Migrations
b.HasOne("Jellyfin.Data.Entities.User", null)
.WithMany("Preferences")
.HasForeignKey("Preference_Preferences_Guid");
b.HasOne("Jellyfin.Data.Entities.Group", null)
.WithMany("Preferences")
.HasForeignKey("Preference_Preferences_Id");
});
modelBuilder.Entity("Jellyfin.Data.Entities.ProviderMapping", b =>
{
b.HasOne("Jellyfin.Data.Entities.Group", null)
.WithMany("ProviderMappings")
.HasForeignKey("ProviderMapping_ProviderMappings_Id");
b.HasOne("Jellyfin.Data.Entities.User", null)
.WithMany("ProviderMappings")
.HasForeignKey("ProviderMapping_ProviderMappings_Id");
});
modelBuilder.Entity("Jellyfin.Data.Entities.User", b =>

View File

@ -97,28 +97,6 @@ namespace Jellyfin.Server.Implementations.Migrations
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_Guid = table.Column<Guid>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Groups", x => x.Id);
table.ForeignKey(
name: "FK_Groups_Users_Group_Groups_Guid",
column: x => x.Group_Groups_Guid,
principalSchema: "jellyfin",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Permissions",
schema: "jellyfin",
@ -129,19 +107,11 @@ 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<Guid>(nullable: true),
Permission_Permissions_Guid = table.Column<Guid>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Permissions", x => x.Id);
table.ForeignKey(
name: "FK_Permissions_Groups_Permission_GroupPermissions_Id",
column: x => x.Permission_GroupPermissions_Id,
principalSchema: "jellyfin",
principalTable: "Groups",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Permissions_Users_Permission_Permissions_Guid",
column: x => x.Permission_Permissions_Guid,
@ -161,8 +131,7 @@ 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_Guid = table.Column<Guid>(nullable: true),
Preference_Preferences_Id = table.Column<Guid>(nullable: true)
Preference_Preferences_Guid = table.Column<Guid>(nullable: true)
},
constraints: table =>
{
@ -174,45 +143,6 @@ namespace Jellyfin.Server.Implementations.Migrations
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Preferences_Groups_Preference_Preferences_Id",
column: x => x.Preference_Preferences_Id,
principalSchema: "jellyfin",
principalTable: "Groups",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "ProviderMapping",
schema: "jellyfin",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ProviderName = table.Column<string>(maxLength: 255, nullable: false),
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<Guid>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ProviderMapping", x => x.Id);
table.ForeignKey(
name: "FK_ProviderMapping_Groups_ProviderMapping_ProviderMappings_Id",
column: x => x.ProviderMapping_ProviderMappings_Id,
principalSchema: "jellyfin",
principalTable: "Groups",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_ProviderMapping_Users_ProviderMapping_ProviderMappings_Id",
column: x => x.ProviderMapping_ProviderMappings_Id,
principalSchema: "jellyfin",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
@ -221,18 +151,6 @@ namespace Jellyfin.Server.Implementations.Migrations
table: "AccessSchedule",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_Groups_Group_Groups_Guid",
schema: "jellyfin",
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_Permissions_Permission_Permissions_Guid",
schema: "jellyfin",
@ -245,18 +163,6 @@ namespace Jellyfin.Server.Implementations.Migrations
table: "Preferences",
column: "Preference_Preferences_Guid");
migrationBuilder.CreateIndex(
name: "IX_Preferences_Preference_Preferences_Id",
schema: "jellyfin",
table: "Preferences",
column: "Preference_Preferences_Id");
migrationBuilder.CreateIndex(
name: "IX_ProviderMapping_ProviderMapping_ProviderMappings_Id",
schema: "jellyfin",
table: "ProviderMapping",
column: "ProviderMapping_ProviderMappings_Id");
migrationBuilder.CreateIndex(
name: "IX_Users_ProfileImageId",
schema: "jellyfin",
@ -278,14 +184,6 @@ namespace Jellyfin.Server.Implementations.Migrations
name: "Preferences",
schema: "jellyfin");
migrationBuilder.DropTable(
name: "ProviderMapping",
schema: "jellyfin");
migrationBuilder.DropTable(
name: "Groups",
schema: "jellyfin");
migrationBuilder.DropTable(
name: "Users",
schema: "jellyfin");

View File

@ -88,31 +88,6 @@ namespace Jellyfin.Server.Implementations.Migrations
b.ToTable("ActivityLogs");
});
modelBuilder.Entity("Jellyfin.Data.Entities.Group", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT");
b.Property<Guid?>("Group_Groups_Guid")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(255);
b.Property<uint>("RowVersion")
.IsConcurrencyToken()
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Group_Groups_Guid");
b.ToTable("Groups");
});
modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b =>
{
b.Property<int>("Id")
@ -141,9 +116,6 @@ namespace Jellyfin.Server.Implementations.Migrations
b.Property<int>("Kind")
.HasColumnType("INTEGER");
b.Property<Guid?>("Permission_GroupPermissions_Id")
.HasColumnType("TEXT");
b.Property<Guid?>("Permission_Permissions_Guid")
.HasColumnType("TEXT");
@ -156,8 +128,6 @@ namespace Jellyfin.Server.Implementations.Migrations
b.HasKey("Id");
b.HasIndex("Permission_GroupPermissions_Id");
b.HasIndex("Permission_Permissions_Guid");
b.ToTable("Permissions");
@ -175,9 +145,6 @@ namespace Jellyfin.Server.Implementations.Migrations
b.Property<Guid?>("Preference_Preferences_Guid")
.HasColumnType("TEXT");
b.Property<Guid?>("Preference_Preferences_Id")
.HasColumnType("TEXT");
b.Property<uint>("RowVersion")
.IsConcurrencyToken()
.HasColumnType("INTEGER");
@ -191,46 +158,9 @@ namespace Jellyfin.Server.Implementations.Migrations
b.HasIndex("Preference_Preferences_Guid");
b.HasIndex("Preference_Preferences_Id");
b.ToTable("Preferences");
});
modelBuilder.Entity("Jellyfin.Data.Entities.ProviderMapping", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ProviderData")
.IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(65535);
b.Property<Guid?>("ProviderMapping_ProviderMappings_Id")
.HasColumnType("TEXT");
b.Property<string>("ProviderName")
.IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(255);
b.Property<string>("ProviderSecrets")
.IsRequired()
.HasColumnType("TEXT")
.HasMaxLength(65535);
b.Property<uint>("RowVersion")
.IsConcurrencyToken()
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ProviderMapping_ProviderMappings_Id");
b.ToTable("ProviderMapping");
});
modelBuilder.Entity("Jellyfin.Data.Entities.User", b =>
{
b.Property<Guid>("Id")
@ -351,19 +281,8 @@ namespace Jellyfin.Server.Implementations.Migrations
.IsRequired();
});
modelBuilder.Entity("Jellyfin.Data.Entities.Group", b =>
{
b.HasOne("Jellyfin.Data.Entities.User", null)
.WithMany("Groups")
.HasForeignKey("Group_Groups_Guid");
});
modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b =>
{
b.HasOne("Jellyfin.Data.Entities.Group", null)
.WithMany("Permissions")
.HasForeignKey("Permission_GroupPermissions_Id");
b.HasOne("Jellyfin.Data.Entities.User", null)
.WithMany("Permissions")
.HasForeignKey("Permission_Permissions_Guid");
@ -374,21 +293,6 @@ namespace Jellyfin.Server.Implementations.Migrations
b.HasOne("Jellyfin.Data.Entities.User", null)
.WithMany("Preferences")
.HasForeignKey("Preference_Preferences_Guid");
b.HasOne("Jellyfin.Data.Entities.Group", null)
.WithMany("Preferences")
.HasForeignKey("Preference_Preferences_Id");
});
modelBuilder.Entity("Jellyfin.Data.Entities.ProviderMapping", b =>
{
b.HasOne("Jellyfin.Data.Entities.Group", null)
.WithMany("ProviderMappings")
.HasForeignKey("ProviderMapping_ProviderMappings_Id");
b.HasOne("Jellyfin.Data.Entities.User", null)
.WithMany("ProviderMappings")
.HasForeignKey("ProviderMapping_ProviderMappings_Id");
});
modelBuilder.Entity("Jellyfin.Data.Entities.User", b =>