doneth.at/migrations/versions/a20adaee67da_.py

37 lines
1.0 KiB
Python

"""Add api keys
Revision ID: a20adaee67da
Revises: 687170684a50
Create Date: 2021-11-17 20:21:01.069492
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a20adaee67da'
down_revision = '687170684a50'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('api_key',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('app_name', sa.String(
length=64), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('hash', sa.String(length=128), nullable=False),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('api_key')
# ### end Alembic commands ###