Add compare_type=True to Migrate constructor

This commit is contained in:
Stephan Porada 2020-07-15 11:02:06 +02:00
parent 13a6ef95c3
commit 644369d1e9
2 changed files with 51 additions and 1 deletions

View File

@ -0,0 +1,50 @@
"""empty message
Revision ID: 9d21b228d353
Revises: 33ec4d09b4ca
Create Date: 2020-07-15 08:58:59.062442
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9d21b228d353'
down_revision = '33ec4d09b4ca'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('corpus_files', 'author',
existing_type=sa.VARCHAR(length=64),
type_=sa.String(length=255),
existing_nullable=True)
op.alter_column('corpus_files', 'title',
existing_type=sa.VARCHAR(length=64),
type_=sa.String(length=255),
existing_nullable=True)
op.alter_column('roles', 'permissions',
existing_type=sa.INTEGER(),
type_=sa.BigInteger(),
existing_nullable=True)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('roles', 'permissions',
existing_type=sa.BigInteger(),
type_=sa.INTEGER(),
existing_nullable=True)
op.alter_column('corpus_files', 'title',
existing_type=sa.String(length=255),
type_=sa.VARCHAR(length=64),
existing_nullable=True)
op.alter_column('corpus_files', 'author',
existing_type=sa.String(length=255),
type_=sa.VARCHAR(length=64),
existing_nullable=True)
# ### end Alembic commands ###

View File

@ -8,7 +8,7 @@ from flask_migrate import Migrate, upgrade
import os import os
app = create_app(os.getenv('FLASK_CONFIG') or 'default') app = create_app(os.getenv('FLASK_CONFIG') or 'default')
migrate = Migrate(app, db) migrate = Migrate(app, db, compare_type=True)
@app.shell_context_processor @app.shell_context_processor