diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20250913211637_AddProperParentChildRelationBaseItemWithCascade.cs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20250913211637_AddProperParentChildRelationBaseItemWithCascade.cs b/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20250913211637_AddProperParentChildRelationBaseItemWithCascade.cs index 77f41edad..11c84d44c 100644 --- a/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20250913211637_AddProperParentChildRelationBaseItemWithCascade.cs +++ b/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20250913211637_AddProperParentChildRelationBaseItemWithCascade.cs @@ -10,6 +10,28 @@ namespace Jellyfin.Server.Implementations.Migrations /// <inheritdoc /> protected override void Up(MigrationBuilder migrationBuilder) { + migrationBuilder.Sql(""" +DELETE FROM BaseItems + WHERE + ParentId IS NOT NULL + AND + NOT EXISTS(SELECT 1 FROM BaseItems parent WHERE ParentId = parent.Id); +DELETE FROM BaseItems + WHERE + ParentId IS NOT NULL + AND + NOT EXISTS(SELECT 1 FROM BaseItems parent WHERE ParentId = parent.Id); +DELETE FROM BaseItems + WHERE + ParentId IS NOT NULL + AND + NOT EXISTS(SELECT 1 FROM BaseItems parent WHERE ParentId = parent.Id); +DELETE FROM BaseItems + WHERE + ParentId IS NOT NULL + AND + NOT EXISTS(SELECT 1 FROM BaseItems parent WHERE ParentId = parent.Id); +"""); migrationBuilder.AddForeignKey( name: "FK_BaseItems_BaseItems_ParentId", table: "BaseItems", |
