From 677304ba3ecbd204fa2726e6820de84ad09bd868 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Tue, 10 Mar 2020 10:34:00 +0100 Subject: Added a tiny portion of black magic. --- .../2472eddbf44b_update_of_the_user_model.py | 37 +++++++++++----------- 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'migrations/versions/2472eddbf44b_update_of_the_user_model.py') diff --git a/migrations/versions/2472eddbf44b_update_of_the_user_model.py b/migrations/versions/2472eddbf44b_update_of_the_user_model.py index a0194090..0a39c943 100644 --- a/migrations/versions/2472eddbf44b_update_of_the_user_model.py +++ b/migrations/versions/2472eddbf44b_update_of_the_user_model.py @@ -7,8 +7,8 @@ Create Date: 2016-03-01 22:35:03.659694 """ # revision identifiers, used by Alembic. -revision = '2472eddbf44b' -down_revision = 'ac35c979311a' +revision = "2472eddbf44b" +down_revision = "ac35c979311a" branch_labels = None depends_on = None @@ -17,22 +17,23 @@ import sqlalchemy as sa def upgrade(): - op.drop_column('user', 'enabled') - op.add_column('user', sa.Column('is_active', sa.Boolean(), default=False)) - op.add_column('user', sa.Column('is_admin', sa.Boolean(), default=False)) - op.add_column('user', sa.Column('is_api', sa.Boolean(), default=False)) - op.drop_table('role') - + op.drop_column("user", "enabled") + op.add_column("user", sa.Column("is_active", sa.Boolean(), default=False)) + op.add_column("user", sa.Column("is_admin", sa.Boolean(), default=False)) + op.add_column("user", sa.Column("is_api", sa.Boolean(), default=False)) + op.drop_table("role") def downgrade(): - op.drop_column('user', 'is_active') - op.drop_column('user', 'is_admin') - op.drop_column('user', 'is_api') - op.create_table('role', - sa.Column('id', sa.INTEGER(), nullable=False), - sa.Column('name', sa.VARCHAR(), nullable=True), - sa.Column('user_id', sa.INTEGER(), nullable=True), - sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('name')) + op.drop_column("user", "is_active") + op.drop_column("user", "is_admin") + op.drop_column("user", "is_api") + op.create_table( + "role", + sa.Column("id", sa.INTEGER(), nullable=False), + sa.Column("name", sa.VARCHAR(), nullable=True), + sa.Column("user_id", sa.INTEGER(), nullable=True), + sa.ForeignKeyConstraint(["user_id"], ["user.id"],), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint("name"), + ) -- cgit