gevent concurrency / asynchronous processes
usage of gunicorn (documented)
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
"""Refactor to flask-security
|
||||
|
||||
Revision ID: 07c7128c166e
|
||||
Revises: b0ac53ab9d12
|
||||
Create Date: 2024-04-25 17:13:28.506058
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '07c7128c166e'
|
||||
down_revision = 'b0ac53ab9d12'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('role',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=80), nullable=True),
|
||||
sa.Column('description', sa.String(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name'),
|
||||
schema='public'
|
||||
)
|
||||
op.create_table('roles_users',
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('role_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['role_id'], ['public.role.id'], ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['public.user.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('user_id', 'role_id'),
|
||||
schema='public'
|
||||
)
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('fs_uniquifier', sa.String(length=255), nullable=False))
|
||||
batch_op.create_unique_constraint(None, ['fs_uniquifier'])
|
||||
batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
batch_op.drop_column('is_admin')
|
||||
batch_op.drop_column('is_super')
|
||||
batch_op.drop_column('is_tester')
|
||||
|
||||
# ### 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.add_column(sa.Column('is_tester', sa.BOOLEAN(), autoincrement=False, nullable=True))
|
||||
batch_op.add_column(sa.Column('is_super', sa.BOOLEAN(), autoincrement=False, nullable=True))
|
||||
batch_op.add_column(sa.Column('is_admin', sa.BOOLEAN(), autoincrement=False, nullable=True))
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
batch_op.drop_constraint(None, type_='unique')
|
||||
batch_op.drop_column('fs_uniquifier')
|
||||
|
||||
op.drop_table('roles_users', schema='public')
|
||||
op.drop_table('role', schema='public')
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,48 @@
|
||||
"""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 ###
|
||||
@@ -0,0 +1,60 @@
|
||||
"""flask-security Trackable
|
||||
|
||||
Revision ID: 3ebec5c5b065
|
||||
Revises: 07c7128c166e
|
||||
Create Date: 2024-04-25 18:01:32.126442
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3ebec5c5b065'
|
||||
down_revision = '07c7128c166e'
|
||||
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_user_id_fkey', type_='foreignkey')
|
||||
batch_op.drop_constraint('roles_users_role_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'user', ['user_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
batch_op.create_foreign_key(None, 'role', ['role_id'], ['id'], referent_schema='public', ondelete='CASCADE')
|
||||
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('last_login_at', sa.DateTime(), nullable=True))
|
||||
batch_op.add_column(sa.Column('current_login_at', sa.DateTime(), nullable=True))
|
||||
batch_op.add_column(sa.Column('last_login_ip', sa.String(length=255), nullable=True))
|
||||
batch_op.add_column(sa.Column('current_login_ip', sa.String(length=255), nullable=True))
|
||||
batch_op.add_column(sa.Column('login_count', sa.Integer(), nullable=False))
|
||||
batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey')
|
||||
batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public')
|
||||
batch_op.drop_column('authenticated')
|
||||
batch_op.drop_column('last_login')
|
||||
|
||||
# ### 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.add_column(sa.Column('last_login', postgresql.TIMESTAMP(), autoincrement=False, nullable=True))
|
||||
batch_op.add_column(sa.Column('authenticated', sa.BOOLEAN(), autoincrement=False, nullable=True))
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id'])
|
||||
batch_op.drop_column('login_count')
|
||||
batch_op.drop_column('current_login_ip')
|
||||
batch_op.drop_column('last_login_ip')
|
||||
batch_op.drop_column('current_login_at')
|
||||
batch_op.drop_column('last_login_at')
|
||||
|
||||
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_role_id_fkey', 'role', ['role_id'], ['id'], ondelete='CASCADE')
|
||||
batch_op.create_foreign_key('roles_users_user_id_fkey', 'user', ['user_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user