mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-05-24 02:02:29 -04:00
Change BaseItemEntity ChannelId to nullable Guid
This commit is contained in:
parent
b2a2fd6fcc
commit
debc499711
@ -22,7 +22,7 @@ public class BaseItemEntity
|
||||
|
||||
public DateTime? EndDate { get; set; }
|
||||
|
||||
public string? ChannelId { get; set; }
|
||||
public Guid? ChannelId { get; set; }
|
||||
|
||||
public bool IsMovie { get; set; }
|
||||
|
||||
|
@ -553,7 +553,7 @@ public sealed class BaseItemRepository
|
||||
dto.Genres = entity.Genres?.Split('|') ?? [];
|
||||
dto.DateCreated = entity.DateCreated.GetValueOrDefault();
|
||||
dto.DateModified = entity.DateModified.GetValueOrDefault();
|
||||
dto.ChannelId = string.IsNullOrWhiteSpace(entity.ChannelId) ? Guid.Empty : (Guid.TryParse(entity.ChannelId, out var channelId) ? channelId : Guid.Empty);
|
||||
dto.ChannelId = entity.ChannelId ?? Guid.Empty;
|
||||
dto.DateLastRefreshed = entity.DateLastRefreshed.GetValueOrDefault();
|
||||
dto.DateLastSaved = entity.DateLastSaved.GetValueOrDefault();
|
||||
dto.OwnerId = string.IsNullOrWhiteSpace(entity.OwnerId) ? Guid.Empty : (Guid.TryParse(entity.OwnerId, out var ownerId) ? ownerId : Guid.Empty);
|
||||
@ -716,7 +716,7 @@ public sealed class BaseItemRepository
|
||||
entity.Genres = string.Join('|', dto.Genres);
|
||||
entity.DateCreated = dto.DateCreated;
|
||||
entity.DateModified = dto.DateModified;
|
||||
entity.ChannelId = dto.ChannelId.ToString();
|
||||
entity.ChannelId = dto.ChannelId;
|
||||
entity.DateLastRefreshed = dto.DateLastRefreshed;
|
||||
entity.DateLastSaved = dto.DateLastSaved;
|
||||
entity.OwnerId = dto.OwnerId.ToString();
|
||||
@ -1451,8 +1451,7 @@ public sealed class BaseItemRepository
|
||||
|
||||
if (filter.ChannelIds.Count > 0)
|
||||
{
|
||||
var channelIds = filter.ChannelIds.Select(e => e.ToString("N", CultureInfo.InvariantCulture)).ToArray();
|
||||
baseQuery = baseQuery.Where(e => channelIds.Contains(e.ChannelId));
|
||||
baseQuery = baseQuery.Where(e => e.ChannelId != null && filter.ChannelIds.Contains(e.ChannelId.Value));
|
||||
}
|
||||
|
||||
if (!filter.ParentId.IsEmpty())
|
||||
|
1595
Jellyfin.Server.Implementations/Migrations/20250214031148_ChannelIdGuid.Designer.cs
generated
Normal file
1595
Jellyfin.Server.Implementations/Migrations/20250214031148_ChannelIdGuid.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Jellyfin.Server.Implementations.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ChannelIdGuid : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
// NOOP, Guids and strings are stored the same in SQLite.
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
// NOOP, Guids and strings are stored the same in SQLite.
|
||||
}
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ namespace Jellyfin.Server.Implementations.Migrations
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.1");
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.2");
|
||||
|
||||
modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b =>
|
||||
{
|
||||
@ -152,7 +152,7 @@ namespace Jellyfin.Server.Implementations.Migrations
|
||||
b.Property<int?>("Audio")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ChannelId")
|
||||
b.Property<Guid?>("ChannelId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("CleanName")
|
||||
|
@ -678,7 +678,7 @@ public class MigrateLibraryDb : IMigrationRoutine
|
||||
entity.EndDate = endDate;
|
||||
}
|
||||
|
||||
if (reader.TryGetString(index++, out var guid))
|
||||
if (reader.TryGetGuid(index++, out var guid))
|
||||
{
|
||||
entity.ChannelId = guid;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user