From 644369d1e9ace0be9d1e6bc699ea0f89f01f757c Mon Sep 17 00:00:00 2001 From: Stephan Porada Date: Wed, 15 Jul 2020 11:02:06 +0200 Subject: [PATCH] Add compare_type=True to Migrate constructor --- web/migrations/versions/9d21b228d353_.py | 50 ++++++++++++++++++++++++ web/nopaque.py | 2 +- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 web/migrations/versions/9d21b228d353_.py diff --git a/web/migrations/versions/9d21b228d353_.py b/web/migrations/versions/9d21b228d353_.py new file mode 100644 index 00000000..33368bbf --- /dev/null +++ b/web/migrations/versions/9d21b228d353_.py @@ -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 ### diff --git a/web/nopaque.py b/web/nopaque.py index c26dfa4c..b19c3b87 100644 --- a/web/nopaque.py +++ b/web/nopaque.py @@ -8,7 +8,7 @@ from flask_migrate import Migrate, upgrade import os app = create_app(os.getenv('FLASK_CONFIG') or 'default') -migrate = Migrate(app, db) +migrate = Migrate(app, db, compare_type=True) @app.shell_context_processor