Skip to content

Commit

Permalink
Fixed latest migration that cleared history for sqlite users.
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheus65535 committed Sep 22, 2023
1 parent 81159a0 commit 0ddadb2
Showing 1 changed file with 8 additions and 27 deletions.
35 changes: 8 additions & 27 deletions migrations/versions/cee6a710cb71_.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,21 @@
branch_labels = None
depends_on = None

bind = op.get_context().bind


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('table_episodes', schema=None) as batch_op:
batch_op.alter_column('file_size',
existing_type=sa.INTEGER(),
type_=sa.BigInteger(),
existing_nullable=True,
existing_server_default=sa.text('0'))

with op.batch_alter_table('table_movies', schema=None) as batch_op:
batch_op.alter_column('file_size',
existing_type=sa.INTEGER(),
type_=sa.BigInteger(),
existing_nullable=True,
existing_server_default=sa.text('0'))
if bind.engine.name == 'postgresql':
with op.batch_alter_table('table_episodes') as batch_op:
batch_op.alter_column('file_size', type_=sa.BigInteger())

with op.batch_alter_table('table_movies') as batch_op:
batch_op.alter_column('file_size', type_=sa.BigInteger())
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('table_movies', schema=None) as batch_op:
batch_op.alter_column('file_size',
existing_type=sa.BigInteger(),
type_=sa.INTEGER(),
existing_nullable=True,
existing_server_default=sa.text('0'))

with op.batch_alter_table('table_episodes', schema=None) as batch_op:
batch_op.alter_column('file_size',
existing_type=sa.BigInteger(),
type_=sa.INTEGER(),
existing_nullable=True,
existing_server_default=sa.text('0'))

pass
# ### end Alembic commands ###

0 comments on commit 0ddadb2

Please sign in to comment.