diff options
| author | JPVenson <github@jpb.email> | 2025-09-26 04:27:17 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-25 19:27:17 -0600 |
| commit | 1736a566ccad07142bde86c0b450175f943e5848 (patch) | |
| tree | 4a890450b809fc4d9a9e7a66e295459bfa2fde1e /src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite | |
| parent | 04ab362e59addcfbfbf6be00bb66cd0d3cc68cc5 (diff) | |
Fixes FK on unconnected base items (#14863)
Diffstat (limited to 'src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite')
| -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", |
