mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-01-01 12:32:25 +08:00
Fixed database migration process causing UNIQUE constraint in some edge cases where duplicate ID root folders where stored. #2253
This commit is contained in:
parent
84e8872652
commit
166d0ccc95
1 changed files with 3 additions and 1 deletions
|
@ -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;')
|
||||
|
|
Loading…
Reference in a new issue