mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-08-19 00:24:28 +00:00
48 lines
1.7 KiB
Python
48 lines
1.7 KiB
Python
"""Add OAuth client
|
|
|
|
Revision ID: 4ab54becec04
|
|
Revises: 9b404c47970a
|
|
Create Date: 2022-12-16 17:30:54.520477+00:00
|
|
|
|
"""
|
|
import sqlalchemy as sa
|
|
|
|
from alembic import op
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '4ab54becec04'
|
|
down_revision = '9b404c47970a'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('oauth_client',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
|
sa.Column('client_name', sa.String(), nullable=False),
|
|
sa.Column('redirect_uris', sa.JSON(), nullable=True),
|
|
sa.Column('client_uri', sa.String(), nullable=True),
|
|
sa.Column('logo_uri', sa.String(), nullable=True),
|
|
sa.Column('scope', sa.String(), nullable=True),
|
|
sa.Column('client_id', sa.String(), nullable=False),
|
|
sa.Column('client_secret', sa.String(), nullable=False),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('client_secret')
|
|
)
|
|
with op.batch_alter_table('oauth_client', schema=None) as batch_op:
|
|
batch_op.create_index(batch_op.f('ix_oauth_client_client_id'), ['client_id'], unique=True)
|
|
batch_op.create_index(batch_op.f('ix_oauth_client_id'), ['id'], unique=False)
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('oauth_client', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_oauth_client_id'))
|
|
batch_op.drop_index(batch_op.f('ix_oauth_client_client_id'))
|
|
|
|
op.drop_table('oauth_client')
|
|
# ### end Alembic commands ###
|