microblog.pub/alembic/versions/192aff8bc1e2_add_indieauth_...

44 lines
1.7 KiB
Python

"""Add IndieAuth auth request model
Revision ID: 192aff8bc1e2
Revises: 79b5bcc918ce
Create Date: 2022-07-10 09:55:29.768385
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '192aff8bc1e2'
down_revision = '79b5bcc918ce'
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('indieauth_authorization_request',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
sa.Column('code', sa.String(), nullable=False),
sa.Column('scope', sa.String(), nullable=False),
sa.Column('redirect_uri', sa.String(), nullable=False),
sa.Column('client_id', sa.String(), nullable=False),
sa.Column('code_challenge', sa.String(), nullable=True),
sa.Column('code_challenge_method', sa.String(), nullable=True),
sa.Column('is_used', sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_indieauth_authorization_request_code'), 'indieauth_authorization_request', ['code'], unique=True)
op.create_index(op.f('ix_indieauth_authorization_request_id'), 'indieauth_authorization_request', ['id'], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_indieauth_authorization_request_id'), table_name='indieauth_authorization_request')
op.drop_index(op.f('ix_indieauth_authorization_request_code'), table_name='indieauth_authorization_request')
op.drop_table('indieauth_authorization_request')
# ### end Alembic commands ###