39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
"""add tags for programs
|
|
|
|
Revision ID: 1de8b6b6aed8
|
|
Revises: fcf53f1a14e3
|
|
Create Date: 2022-05-19 18:50:12.894735
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '1de8b6b6aed8'
|
|
down_revision = 'fcf53f1a14e3'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('tag',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('post_id', sa.Integer(), nullable=True),
|
|
sa.Column('name', sa.String(length=64), nullable=True),
|
|
sa.ForeignKeyConstraint(['post_id'], ['post.id'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index(op.f('ix_tag_name'), 'tag', ['name'], unique=False)
|
|
op.create_index(op.f('ix_tag_post_id'), 'tag', ['post_id'], unique=False)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f('ix_tag_post_id'), table_name='tag')
|
|
op.drop_index(op.f('ix_tag_name'), table_name='tag')
|
|
op.drop_table('tag')
|
|
# ### end Alembic commands ###
|