47 lines
1.2 KiB
Python
47 lines
1.2 KiB
Python
|
"""empty message
|
||
|
|
||
|
Revision ID: 27761560bbcb
|
||
|
Revises:
|
||
|
Create Date: 2021-12-21 06:07:14.857940
|
||
|
|
||
|
"""
|
||
|
import sqlalchemy as sa
|
||
|
from alembic import op
|
||
|
|
||
|
# revision identifiers, used by Alembic.
|
||
|
revision = "27761560bbcb"
|
||
|
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.PrimaryKeyConstraint("id"),
|
||
|
sa.UniqueConstraint("slug"),
|
||
|
)
|
||
|
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", sa.String(length=64), nullable=True),
|
||
|
sa.ForeignKeyConstraint(
|
||
|
["app_id"],
|
||
|
["app.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("app")
|
||
|
# ### end Alembic commands ###
|