diff options
author | morpheus65535 <[email protected]> | 2023-07-30 13:00:55 -0400 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2023-07-30 13:00:55 -0400 |
commit | 26f6fcb3adf3440d56c686ea87c8ee00a3724435 (patch) | |
tree | aacdad8f4a4cc46e1c28d8f416cb5444ed323a9a /migrations | |
parent | 18cec2c8e50cd4bb7cdf1a34761b895ee64f824a (diff) | |
download | bazarr-26f6fcb3adf3440d56c686ea87c8ee00a3724435.tar.gz bazarr-26f6fcb3adf3440d56c686ea87c8ee00a3724435.zip |
Fixed missing table during migration of a new database.v1.2.5-beta.7
Diffstat (limited to 'migrations')
-rw-r--r-- | migrations/versions/dc09994b7e65_.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/migrations/versions/dc09994b7e65_.py b/migrations/versions/dc09994b7e65_.py index d91f9e38c..fd30258d8 100644 --- a/migrations/versions/dc09994b7e65_.py +++ b/migrations/versions/dc09994b7e65_.py @@ -24,6 +24,7 @@ depends_on = None bind = op.get_context().bind insp = sa.inspect(bind) +tables = insp.get_table_names() should_recreate = 'always' if bind.engine.name == 'sqlite' else 'auto' @@ -58,10 +59,11 @@ def upgrade(): batch_op.add_column(sa.Column('id', sa.Integer, primary_key=True)) # Update custom_score_profile_conditions table - with op.batch_alter_table('table_custom_score_profile_conditions') as batch_op: - batch_op.execute('DROP INDEX IF EXISTS tablecustomscoreprofileconditions_profile_id') - batch_op.alter_column('profile_id', index=False) - batch_op.execute('DROP INDEX IF EXISTS ix_table_custom_score_profile_conditions_profile_id;') + if 'table_custom_score_profile_conditions' in tables: + with op.batch_alter_table('table_custom_score_profile_conditions') as batch_op: + batch_op.execute('DROP INDEX IF EXISTS tablecustomscoreprofileconditions_profile_id') + batch_op.alter_column('profile_id', index=False) + batch_op.execute('DROP INDEX IF EXISTS ix_table_custom_score_profile_conditions_profile_id;') # Update notifier table with op.batch_alter_table('table_settings_notifier') as batch_op: |