diff options
author | JayZed <[email protected]> | 2024-07-08 17:33:43 -0400 |
---|---|---|
committer | JayZed <[email protected]> | 2024-07-08 17:33:43 -0400 |
commit | 4cc6806193127f9d6d3f2dab26969471d9bbf159 (patch) | |
tree | bfc90e4b55fa0f48f83e51c4e5947c1f7d7d7a2d /migrations/versions/452dd0f0b578_.py | |
parent | d875dc7733c901246881325ee3a84fe5d44b10b9 (diff) | |
parent | 5886c20c9c7929bf46836a99c2d9d4eb834638bd (diff) | |
download | bazarr-4cc6806193127f9d6d3f2dab26969471d9bbf159.tar.gz bazarr-4cc6806193127f9d6d3f2dab26969471d9bbf159.zip |
Merge branch 'development' of https://github.com/morpheus65535/bazarr into development
Diffstat (limited to 'migrations/versions/452dd0f0b578_.py')
-rw-r--r-- | migrations/versions/452dd0f0b578_.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/migrations/versions/452dd0f0b578_.py b/migrations/versions/452dd0f0b578_.py new file mode 100644 index 000000000..13e623988 --- /dev/null +++ b/migrations/versions/452dd0f0b578_.py @@ -0,0 +1,46 @@ +"""empty message + +Revision ID: 452dd0f0b578 +Revises: 30f37e2e15e1 +Create Date: 2024-05-06 20:27:15.618027 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '452dd0f0b578' +down_revision = '30f37e2e15e1' +branch_labels = None +depends_on = None + +bind = op.get_context().bind +insp = sa.inspect(bind) + + +def column_exists(table_name, column_name): + columns = insp.get_columns(table_name) + return any(c["name"] == column_name for c in columns) + + +def upgrade(): + if column_exists('table_shows', 'alternativeTitle'): + with op.batch_alter_table('table_shows', schema=None) as batch_op: + batch_op.drop_column('alternativeTitle') + + if not column_exists('table_languages_profiles', 'originalFormat'): + with op.batch_alter_table('table_languages_profiles', schema=None) as batch_op: + batch_op.add_column(sa.Column('originalFormat', sa.Integer(), server_default='0')) + + if not column_exists('table_languages_profiles', 'mustContain'): + with op.batch_alter_table('table_languages_profiles', schema=None) as batch_op: + batch_op.add_column(sa.Column('mustContain', sa.Text(), server_default='[]')) + + if not column_exists('table_languages_profiles', 'mustNotContain'): + with op.batch_alter_table('table_languages_profiles', schema=None) as batch_op: + batch_op.add_column(sa.Column('mustNotContain', sa.Text(), server_default='[]')) + + +def downgrade(): + pass |