Fixed AncestorIds and applied review comments

This commit is contained in:
JPVenson
2024-10-09 23:19:24 +00:00
parent eb601e944c
commit 2955f2f562
16 changed files with 3275 additions and 181 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,89 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Jellyfin.Server.Implementations.Migrations
{
/// <inheritdoc />
public partial class FixedAncestorIds : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_AncestorIds_BaseItems_ItemId",
table: "AncestorIds");
migrationBuilder.DropIndex(
name: "IX_AncestorIds_ItemId_AncestorIdText",
table: "AncestorIds");
migrationBuilder.RenameColumn(
name: "AncestorIdText",
table: "AncestorIds",
newName: "BaseItemEntityId");
migrationBuilder.RenameColumn(
name: "Id",
table: "AncestorIds",
newName: "ParentItemId");
migrationBuilder.RenameIndex(
name: "IX_AncestorIds_Id",
table: "AncestorIds",
newName: "IX_AncestorIds_ParentItemId");
migrationBuilder.CreateIndex(
name: "IX_AncestorIds_BaseItemEntityId",
table: "AncestorIds",
column: "BaseItemEntityId");
migrationBuilder.AddForeignKey(
name: "FK_AncestorIds_BaseItems_BaseItemEntityId",
table: "AncestorIds",
column: "BaseItemEntityId",
principalTable: "BaseItems",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_AncestorIds_BaseItems_BaseItemEntityId",
table: "AncestorIds");
migrationBuilder.DropIndex(
name: "IX_AncestorIds_BaseItemEntityId",
table: "AncestorIds");
migrationBuilder.RenameColumn(
name: "BaseItemEntityId",
table: "AncestorIds",
newName: "AncestorIdText");
migrationBuilder.RenameColumn(
name: "ParentItemId",
table: "AncestorIds",
newName: "Id");
migrationBuilder.RenameIndex(
name: "IX_AncestorIds_ParentItemId",
table: "AncestorIds",
newName: "IX_AncestorIds_Id");
migrationBuilder.CreateIndex(
name: "IX_AncestorIds_ItemId_AncestorIdText",
table: "AncestorIds",
columns: new[] { "ItemId", "AncestorIdText" });
migrationBuilder.AddForeignKey(
name: "FK_AncestorIds_BaseItems_ItemId",
table: "AncestorIds",
column: "ItemId",
principalTable: "BaseItems",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,36 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Jellyfin.Server.Implementations.Migrations
{
/// <inheritdoc />
public partial class FixedStreamType : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "StreamType",
table: "MediaStreamInfos",
type: "INTEGER",
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT",
oldNullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "StreamType",
table: "MediaStreamInfos",
type: "TEXT",
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER",
oldNullable: true);
}
}
}

View File

@@ -95,17 +95,17 @@ namespace Jellyfin.Server.Implementations.Migrations
b.Property<Guid>("ItemId")
.HasColumnType("TEXT");
b.Property<Guid>("Id")
b.Property<Guid>("ParentItemId")
.HasColumnType("TEXT");
b.Property<string>("AncestorIdText")
b.Property<Guid?>("BaseItemEntityId")
.HasColumnType("TEXT");
b.HasKey("ItemId", "Id");
b.HasKey("ItemId", "ParentItemId");
b.HasIndex("Id");
b.HasIndex("BaseItemEntityId");
b.HasIndex("ItemId", "AncestorIdText");
b.HasIndex("ParentItemId");
b.ToTable("AncestorIds");
});
@@ -865,8 +865,8 @@ namespace Jellyfin.Server.Implementations.Migrations
b.Property<int>("SampleRate")
.HasColumnType("INTEGER");
b.Property<string>("StreamType")
.HasColumnType("TEXT");
b.Property<int?>("StreamType")
.HasColumnType("INTEGER");
b.Property<string>("TimeBase")
.IsRequired()
@@ -1304,13 +1304,9 @@ namespace Jellyfin.Server.Implementations.Migrations
modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b =>
{
b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item")
b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", null)
.WithMany("AncestorIds")
.HasForeignKey("ItemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Item");
.HasForeignKey("BaseItemEntityId");
});
modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b =>