35 lines
935 B
Python
35 lines
935 B
Python
"""Remove user_id from ApiKey
|
|
|
|
Revision ID: 4b74b8a01154
|
|
Revises:
|
|
Create Date: 2025-05-27 11:13:02.044857
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '4b74b8a01154'
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# SQLite doesn't enforce foreign key constraints by default
|
|
# So we can just drop the column
|
|
with op.batch_alter_table('app_auth_api_keys', schema=None) as batch_op:
|
|
batch_op.drop_column('user_id')
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('app_auth_api_keys', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('user_id', sa.INTEGER(), nullable=False))
|
|
batch_op.create_foreign_key('fk_api_keys_user_id', 'app_auth_users', ['user_id'], ['id'])
|
|
|
|
# ### end Alembic commands ###
|