Browse Source

Fix annoying alembic warning when using SQLite

sh4nks 8 years ago
parent
commit
21a6819524
1 changed files with 6 additions and 4 deletions
  1. 6 4
      migrations/versions/221d918aa9f0_add_user_authentication_infos.py

+ 6 - 4
migrations/versions/221d918aa9f0_add_user_authentication_infos.py

@@ -15,10 +15,12 @@ import sqlalchemy as sa
 
 
 def upgrade():
-    ### commands auto generated by Alembic - please adjust! ###
-    op.add_column('users', sa.Column('activated', sa.Boolean(), nullable=True))
-    op.add_column('users', sa.Column('last_failed_login', sa.DateTime(), nullable=True))
-    op.add_column('users', sa.Column('login_attempts', sa.Integer(), nullable=True))
+    # has no effect on other DBMS
+    # read here for more info: http://alembic.zzzcomputing.com/en/latest/ops.html#alembic.operations.Operations.batch_alter_table
+    with op.batch_alter_table('users', schema=None) as batch_op:
+        batch_op.add_column(sa.Column('activated', sa.Boolean(), nullable=True))
+        batch_op.add_column(sa.Column('last_failed_login', sa.DateTime(), nullable=True))
+        batch_op.add_column(sa.Column('login_attempts', sa.Integer(), nullable=True))
     ### end Alembic commands ###