add migrations from SSO repo
This commit is contained in:
parent
3d70482029
commit
b53bffbcd6
5 changed files with 212 additions and 0 deletions
46
migrations/versions/27761560bbcb_.py
Normal file
46
migrations/versions/27761560bbcb_.py
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
"""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 ###
|
||||
Reference in a new issue