PCv5/migrations/versions/189bbc0e1543_add_tag_inform...

43 lines
1.4 KiB
Python

"""add tag information
Revision ID: 189bbc0e1543
Revises: fa34c9f43c24
Create Date: 2022-06-09 22:26:58.562710
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '189bbc0e1543'
down_revision = 'fa34c9f43c24'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('tag_information',
sa.Column('id', sa.String(length=64), nullable=False),
sa.Column('pretty', sa.String(length=64), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.add_column('tag', sa.Column('tag_id', sa.String(length=64), nullable=True))
op.drop_index('ix_tag_name', table_name='tag')
op.create_index(op.f('ix_tag_tag_id'), 'tag', ['tag_id'], unique=False)
op.create_foreign_key(None, 'tag', 'tag_information', ['tag_id'], ['id'])
op.drop_column('tag', 'name')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('tag', sa.Column('name', sa.VARCHAR(length=64), autoincrement=False, nullable=True))
op.drop_constraint(None, 'tag', type_='foreignkey')
op.drop_index(op.f('ix_tag_tag_id'), table_name='tag')
op.create_index('ix_tag_name', 'tag', ['name'], unique=False)
op.drop_column('tag', 'tag_id')
op.drop_table('tag_information')
# ### end Alembic commands ###