|
@@ -17,6 +17,8 @@ depends_on = None
|
|
|
|
|
|
|
|
|
def upgrade():
|
|
|
+ connection = op.get_bind()
|
|
|
+
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
|
with op.batch_alter_table('conversations', schema=None) as batch_op:
|
|
|
batch_op.alter_column('date_created',
|
|
@@ -28,13 +30,15 @@ def upgrade():
|
|
|
existing_type=flaskbb.utils.database.UTCDateTime(timezone=True),
|
|
|
nullable=False)
|
|
|
|
|
|
- with op.batch_alter_table('groups_users', schema=None) as batch_op:
|
|
|
- batch_op.alter_column('group_id',
|
|
|
- existing_type=sa.INTEGER(),
|
|
|
- nullable=False)
|
|
|
- batch_op.alter_column('user_id',
|
|
|
- existing_type=sa.INTEGER(),
|
|
|
- nullable=False)
|
|
|
+ # See https://github.com/sh4nks/flaskbb/issues/309
|
|
|
+ if connection.engine.dialect.name != "mysql":
|
|
|
+ with op.batch_alter_table('groups_users', schema=None) as batch_op:
|
|
|
+ batch_op.alter_column('group_id',
|
|
|
+ existing_type=sa.INTEGER(),
|
|
|
+ nullable=False)
|
|
|
+ batch_op.alter_column('user_id',
|
|
|
+ existing_type=sa.INTEGER(),
|
|
|
+ nullable=False)
|
|
|
|
|
|
with op.batch_alter_table('messages', schema=None) as batch_op:
|
|
|
batch_op.alter_column('date_created',
|
|
@@ -97,6 +101,8 @@ def upgrade():
|
|
|
|
|
|
|
|
|
def downgrade():
|
|
|
+ connection = op.get_bind()
|
|
|
+
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
|
with op.batch_alter_table('users', schema=None) as batch_op:
|
|
|
batch_op.alter_column('login_attempts',
|
|
@@ -155,13 +161,14 @@ def downgrade():
|
|
|
existing_type=flaskbb.utils.database.UTCDateTime(timezone=True),
|
|
|
nullable=True)
|
|
|
|
|
|
- with op.batch_alter_table('groups_users', schema=None) as batch_op:
|
|
|
- batch_op.alter_column('user_id',
|
|
|
- existing_type=sa.INTEGER(),
|
|
|
- nullable=True)
|
|
|
- batch_op.alter_column('group_id',
|
|
|
- existing_type=sa.INTEGER(),
|
|
|
- nullable=True)
|
|
|
+ if connection.engine.dialect.name != "mysql":
|
|
|
+ with op.batch_alter_table('groups_users', schema=None) as batch_op:
|
|
|
+ batch_op.alter_column('user_id',
|
|
|
+ existing_type=sa.INTEGER(),
|
|
|
+ nullable=True)
|
|
|
+ batch_op.alter_column('group_id',
|
|
|
+ existing_type=sa.INTEGER(),
|
|
|
+ nullable=True)
|
|
|
|
|
|
with op.batch_alter_table('forumsread', schema=None) as batch_op:
|
|
|
batch_op.alter_column('last_read',
|