mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Actually fix profile images
This commit is contained in:
parent
1e1386bbc6
commit
3278015444
@ -52,7 +52,6 @@ namespace Jellyfin.Data.Entities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
[Required]
|
[Required]
|
||||||
[ForeignKey("Id")]
|
|
||||||
public Guid UserId { get; protected set; }
|
public Guid UserId { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -17,6 +17,8 @@ namespace Jellyfin.Data.Entities
|
|||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
public int Id { get; protected set; }
|
public int Id { get; protected set; }
|
||||||
|
|
||||||
|
public Guid? UserId { get; protected set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
[MaxLength(512)]
|
[MaxLength(512)]
|
||||||
[StringLength(512)]
|
[StringLength(512)]
|
||||||
|
@ -324,6 +324,7 @@ namespace Jellyfin.Data.Entities
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the user's profile image. Can be <c>null</c>.
|
/// Gets or sets the user's profile image. Can be <c>null</c>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
// [ForeignKey("UserId")]
|
||||||
public virtual ImageInfo ProfileImage { get; set; }
|
public virtual ImageInfo ProfileImage { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
#pragma warning disable SA1601
|
|
||||||
|
|
||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
using System;
|
||||||
@ -12,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("20200613155524_AddUsers")]
|
[Migration("20200613202153_AddUsers")]
|
||||||
partial class AddUsers
|
partial class AddUsers
|
||||||
{
|
{
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@ -107,8 +106,14 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
.HasColumnType("TEXT")
|
.HasColumnType("TEXT")
|
||||||
.HasMaxLength(512);
|
.HasMaxLength(512);
|
||||||
|
|
||||||
|
b.Property<Guid?>("UserId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("ImageInfos");
|
b.ToTable("ImageInfos");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -239,9 +244,6 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
b.Property<bool>("PlayDefaultAudioTrack")
|
b.Property<bool>("PlayDefaultAudioTrack")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<int?>("ProfileImageId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<bool>("RememberAudioSelections")
|
b.Property<bool>("RememberAudioSelections")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
@ -272,8 +274,6 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("ProfileImageId");
|
|
||||||
|
|
||||||
b.ToTable("Users");
|
b.ToTable("Users");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -286,6 +286,13 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Jellyfin.Data.Entities.User", null)
|
||||||
|
.WithOne("ProfileImage")
|
||||||
|
.HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId");
|
||||||
|
});
|
||||||
|
|
||||||
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)
|
||||||
@ -299,13 +306,6 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
.WithMany("Preferences")
|
.WithMany("Preferences")
|
||||||
.HasForeignKey("Preference_Preferences_Guid");
|
.HasForeignKey("Preference_Preferences_Guid");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Jellyfin.Data.Entities.User", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Jellyfin.Data.Entities.ImageInfo", "ProfileImage")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ProfileImageId");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,21 +10,6 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
{
|
{
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "ImageInfos",
|
|
||||||
schema: "jellyfin",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(nullable: false)
|
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
|
||||||
Path = table.Column<string>(maxLength: 512, nullable: false),
|
|
||||||
LastModified = table.Column<DateTime>(nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_ImageInfos", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Users",
|
name: "Users",
|
||||||
schema: "jellyfin",
|
schema: "jellyfin",
|
||||||
@ -57,20 +42,12 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
MaxParentalAgeRating = table.Column<int>(nullable: true),
|
MaxParentalAgeRating = table.Column<int>(nullable: true),
|
||||||
RemoteClientBitrateLimit = table.Column<int>(nullable: true),
|
RemoteClientBitrateLimit = table.Column<int>(nullable: true),
|
||||||
InternalId = table.Column<long>(nullable: false),
|
InternalId = table.Column<long>(nullable: false),
|
||||||
ProfileImageId = table.Column<int>(nullable: true),
|
|
||||||
SyncPlayAccess = table.Column<int>(nullable: false),
|
SyncPlayAccess = table.Column<int>(nullable: false),
|
||||||
RowVersion = table.Column<uint>(nullable: false)
|
RowVersion = table.Column<uint>(nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_Users", x => x.Id);
|
table.PrimaryKey("PK_Users", x => x.Id);
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Users_ImageInfos_ProfileImageId",
|
|
||||||
column: x => x.ProfileImageId,
|
|
||||||
principalSchema: "jellyfin",
|
|
||||||
principalTable: "ImageInfos",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Restrict);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
@ -97,6 +74,29 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ImageInfos",
|
||||||
|
schema: "jellyfin",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
UserId = table.Column<Guid>(nullable: true),
|
||||||
|
Path = table.Column<string>(maxLength: 512, nullable: false),
|
||||||
|
LastModified = table.Column<DateTime>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ImageInfos", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ImageInfos_Users_UserId",
|
||||||
|
column: x => x.UserId,
|
||||||
|
principalSchema: "jellyfin",
|
||||||
|
principalTable: "Users",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Permissions",
|
name: "Permissions",
|
||||||
schema: "jellyfin",
|
schema: "jellyfin",
|
||||||
@ -151,6 +151,13 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
table: "AccessSchedules",
|
table: "AccessSchedules",
|
||||||
column: "UserId");
|
column: "UserId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ImageInfos_UserId",
|
||||||
|
schema: "jellyfin",
|
||||||
|
table: "ImageInfos",
|
||||||
|
column: "UserId",
|
||||||
|
unique: true);
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_Permissions_Permission_Permissions_Guid",
|
name: "IX_Permissions_Permission_Permissions_Guid",
|
||||||
schema: "jellyfin",
|
schema: "jellyfin",
|
||||||
@ -162,12 +169,6 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
schema: "jellyfin",
|
schema: "jellyfin",
|
||||||
table: "Preferences",
|
table: "Preferences",
|
||||||
column: "Preference_Preferences_Guid");
|
column: "Preference_Preferences_Guid");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Users_ProfileImageId",
|
|
||||||
schema: "jellyfin",
|
|
||||||
table: "Users",
|
|
||||||
column: "ProfileImageId");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
@ -176,6 +177,10 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
name: "AccessSchedules",
|
name: "AccessSchedules",
|
||||||
schema: "jellyfin");
|
schema: "jellyfin");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ImageInfos",
|
||||||
|
schema: "jellyfin");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Permissions",
|
name: "Permissions",
|
||||||
schema: "jellyfin");
|
schema: "jellyfin");
|
||||||
@ -187,10 +192,6 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Users",
|
name: "Users",
|
||||||
schema: "jellyfin");
|
schema: "jellyfin");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "ImageInfos",
|
|
||||||
schema: "jellyfin");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -102,8 +102,14 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
.HasColumnType("TEXT")
|
.HasColumnType("TEXT")
|
||||||
.HasMaxLength(512);
|
.HasMaxLength(512);
|
||||||
|
|
||||||
|
b.Property<Guid?>("UserId")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("UserId")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("ImageInfos");
|
b.ToTable("ImageInfos");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -234,9 +240,6 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
b.Property<bool>("PlayDefaultAudioTrack")
|
b.Property<bool>("PlayDefaultAudioTrack")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<int?>("ProfileImageId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<bool>("RememberAudioSelections")
|
b.Property<bool>("RememberAudioSelections")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
@ -267,8 +270,6 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("ProfileImageId");
|
|
||||||
|
|
||||||
b.ToTable("Users");
|
b.ToTable("Users");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -281,6 +282,13 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Jellyfin.Data.Entities.User", null)
|
||||||
|
.WithOne("ProfileImage")
|
||||||
|
.HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId");
|
||||||
|
});
|
||||||
|
|
||||||
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)
|
||||||
@ -294,13 +302,6 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
.WithMany("Preferences")
|
.WithMany("Preferences")
|
||||||
.HasForeignKey("Preference_Preferences_Guid");
|
.HasForeignKey("Preference_Preferences_Guid");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Jellyfin.Data.Entities.User", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Jellyfin.Data.Entities.ImageInfo", "ProfileImage")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ProfileImageId");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -671,7 +671,7 @@ namespace Jellyfin.Server.Implementations.Users
|
|||||||
public void ClearProfileImage(User user)
|
public void ClearProfileImage(User user)
|
||||||
{
|
{
|
||||||
var dbContext = _dbProvider.CreateContext();
|
var dbContext = _dbProvider.CreateContext();
|
||||||
dbContext.ImageInfos.Remove(user.ProfileImage);
|
dbContext.Remove(user.ProfileImage);
|
||||||
dbContext.SaveChanges();
|
dbContext.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user