diff options
author | morpheus65535 <[email protected]> | 2023-09-25 19:42:19 -0400 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2023-09-25 19:42:19 -0400 |
commit | 166d0ccc95112173acf6f6967b2d13cbb5d662c9 (patch) | |
tree | 638bdc96a83e1b0bbd8abbcb1442357277fa3e1a | |
parent | 84e887265278a63db1db53ca4d0a1d15fb941a94 (diff) | |
download | bazarr-166d0ccc95112173acf6f6967b2d13cbb5d662c9.tar.gz bazarr-166d0ccc95112173acf6f6967b2d13cbb5d662c9.zip |
Fixed database migration process causing UNIQUE constraint in some edge cases where duplicate ID root folders where stored. #2253
-rw-r--r-- | migrations/versions/dc09994b7e65_.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/migrations/versions/dc09994b7e65_.py b/migrations/versions/dc09994b7e65_.py index 7274f252f..6670852b1 100644 --- a/migrations/versions/dc09994b7e65_.py +++ b/migrations/versions/dc09994b7e65_.py @@ -14,7 +14,7 @@ except ImportError: pass from app.database import TableHistory, TableHistoryMovie, TableBlacklist, TableBlacklistMovie, TableEpisodes, \ - TableShows, TableMovies, TableLanguagesProfiles + TableShows, TableMovies, TableLanguagesProfiles, TableShowsRootfolder, TableMoviesRootfolder # revision identifiers, used by Alembic. revision = 'dc09994b7e65' @@ -178,6 +178,7 @@ def upgrade(): # Update series rootfolder table with op.batch_alter_table('table_shows_rootfolder') as batch_op: + batch_op.execute(sa.delete(TableShowsRootfolder)) if bind.engine.name == 'postgresql': batch_op.execute('ALTER TABLE table_shows_rootfolder DROP CONSTRAINT IF EXISTS ' 'table_shows_rootfolder_pkey CASCADE;') @@ -259,6 +260,7 @@ def upgrade(): # Update movies rootfolder table with op.batch_alter_table('table_movies_rootfolder') as batch_op: + batch_op.execute(sa.delete(TableMoviesRootfolder)) if bind.engine.name == 'postgresql': batch_op.execute('ALTER TABLE table_movies_rootfolder DROP CONSTRAINT IF EXISTS ' 'table_movies_rootfolder_pkey CASCADE;') |