mirror of
https://github.com/aquatix/digimarks.git
synced 2025-12-06 20:55:10 +01:00
54 lines
2.1 KiB
Python
54 lines
2.1 KiB
Python
"""Renamed keys
|
|
|
|
Revision ID: b8cbc6957df5
|
|
Revises: a8d8e45f60a1
|
|
Create Date: 2025-09-12 22:26:38.684120
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
import sqlmodel
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = 'b8cbc6957df5'
|
|
down_revision: Union[str, Sequence[str], None] = 'a8d8e45f60a1'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Upgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('bookmark', schema=None) as batch_op:
|
|
batch_op.drop_constraint(batch_op.f('bookmark_user'), type_='foreignkey')
|
|
batch_op.alter_column('userkey', new_column_name='user_key')
|
|
batch_op.create_foreign_key('bookmark_user', 'user', ['user_key'], ['key'])
|
|
|
|
with op.batch_alter_table('publictag', schema=None) as batch_op:
|
|
batch_op.drop_constraint(batch_op.f('publictag_user'), type_='foreignkey')
|
|
batch_op.alter_column('userkey', new_column_name='user_key')
|
|
batch_op.alter_column('tagkey', new_column_name='tag_key')
|
|
batch_op.create_foreign_key('publictag_user', 'user', ['user_key'], ['key'])
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('publictag', schema=None) as batch_op:
|
|
batch_op.drop_constraint(batch_op.f('publictag_user'), type_='foreignkey')
|
|
batch_op.alter_column('user_key', new_column_name='userkey')
|
|
batch_op.alter_column('tag_key', new_column_name='tagkey')
|
|
batch_op.create_foreign_key('publictag_user', 'user', ['userkey'], ['key'])
|
|
|
|
with op.batch_alter_table('bookmark', schema=None) as batch_op:
|
|
batch_op.drop_constraint(batch_op.f('bookmark_user'), type_='foreignkey')
|
|
batch_op.alter_column('user_key', new_column_name='userkey')
|
|
batch_op.create_foreign_key('bookmark_user', 'user', ['userkey'], ['key'])
|
|
|
|
# ### end Alembic commands ###
|