Files
eveAI/migrations/public/versions/08e334d64cab_flask_security_active_attribute.py
Josako 602a450114 gevent concurrency / asynchronous processes
usage of gunicorn (documented)
2024-04-30 22:46:56 +02:00

49 lines
2.0 KiB
Python

"""flask-security active attribute
Revision ID: 08e334d64cab
Revises: 3ebec5c5b065
Create Date: 2024-04-29 10:44:35.514268
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '08e334d64cab'
down_revision = '3ebec5c5b065'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('roles_users', schema=None) as batch_op:
batch_op.drop_constraint('roles_users_role_id_fkey', type_='foreignkey')
batch_op.drop_constraint('roles_users_user_id_fkey', type_='foreignkey')
batch_op.create_foreign_key(None, 'role', ['role_id'], ['id'], referent_schema='public', ondelete='CASCADE')
batch_op.create_foreign_key(None, 'user', ['user_id'], ['id'], referent_schema='public', ondelete='CASCADE')
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.add_column(sa.Column('active', sa.Boolean(), nullable=True))
batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey')
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
batch_op.drop_column('active')
with op.batch_alter_table('roles_users', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
batch_op.drop_constraint(None, type_='foreignkey')
batch_op.create_foreign_key('roles_users_user_id_fkey', 'user', ['user_id'], ['id'], ondelete='CASCADE')
batch_op.create_foreign_key('roles_users_role_id_fkey', 'role', ['role_id'], ['id'], ondelete='CASCADE')
# ### end Alembic commands ###