52 lines
1.5 KiB
Python
52 lines
1.5 KiB
Python
|
"""empty message
|
||
|
|
||
|
Revision ID: d70b750a1297
|
||
|
Revises:
|
||
|
Create Date: 2022-10-25 11:32:27.303354
|
||
|
|
||
|
"""
|
||
|
from alembic import op
|
||
|
import sqlalchemy as sa
|
||
|
|
||
|
|
||
|
# revision identifiers, used by Alembic.
|
||
|
revision = 'd70b750a1297'
|
||
|
down_revision = None
|
||
|
branch_labels = None
|
||
|
depends_on = None
|
||
|
|
||
|
|
||
|
def upgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.create_table('app',
|
||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||
|
sa.Column('name', sa.String(length=64), nullable=True),
|
||
|
sa.Column('slug', sa.String(length=64), nullable=True),
|
||
|
sa.Column('external', sa.Boolean(), server_default='0', nullable=False),
|
||
|
sa.Column('url', sa.String(length=128), nullable=True),
|
||
|
sa.PrimaryKeyConstraint('id'),
|
||
|
sa.UniqueConstraint('slug')
|
||
|
)
|
||
|
op.create_table('role',
|
||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||
|
sa.Column('name', sa.String(length=64), nullable=True),
|
||
|
sa.PrimaryKeyConstraint('id')
|
||
|
)
|
||
|
op.create_table('app_role',
|
||
|
sa.Column('user_id', sa.String(length=64), nullable=False),
|
||
|
sa.Column('app_id', sa.Integer(), nullable=False),
|
||
|
sa.Column('role_id', sa.Integer(), nullable=True),
|
||
|
sa.ForeignKeyConstraint(['app_id'], ['app.id'], ),
|
||
|
sa.ForeignKeyConstraint(['role_id'], ['role.id'], ),
|
||
|
sa.PrimaryKeyConstraint('user_id', 'app_id')
|
||
|
)
|
||
|
# ### end Alembic commands ###
|
||
|
|
||
|
|
||
|
def downgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.drop_table('app_role')
|
||
|
op.drop_table('role')
|
||
|
op.drop_table('app')
|
||
|
# ### end Alembic commands ###
|