"""user roles permissions Revision ID: f1f0c854ae18 Revises: e82f86c550ac Create Date: 2023-10-18 21:39:43.281172 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'f1f0c854ae18' down_revision = 'e82f86c550ac' 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=50), nullable=True), sa.Column('weight', sa.Integer(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_table('role_permission', sa.Column('role_id', sa.Integer(), nullable=False), sa.Column('permission', sa.String(), nullable=False), sa.PrimaryKeyConstraint('role_id', 'permission') ) with op.batch_alter_table('role_permission', schema=None) as batch_op: batch_op.create_index(batch_op.f('ix_role_permission_permission'), ['permission'], unique=False) op.create_table('user_role', sa.Column('user_id', sa.Integer(), nullable=False), sa.Column('role_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['role_id'], ['role.id'], ), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), sa.PrimaryKeyConstraint('user_id', 'role_id') ) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_table('user_role') with op.batch_alter_table('role_permission', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_role_permission_permission')) op.drop_table('role_permission') op.drop_table('role') # ### end Alembic commands ###