47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
"""init
|
|
|
|
Revision ID: 85284752d1d5
|
|
Revises: bbacde35234d
|
|
Create Date: 2022-04-30 14:21:08.576738
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '85284752d1d5'
|
|
down_revision = 'bbacde35234d'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('tags',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('topic', sa.Unicode(length=25), nullable=True),
|
|
sa.Column('tag', sa.Unicode(length=25), nullable=True),
|
|
sa.Column('title', sa.Unicode(length=25), nullable=False),
|
|
sa.PrimaryKeyConstraint('id', name=op.f('pk_tags')),
|
|
sa.UniqueConstraint('title', name=op.f('uq_tags_title'))
|
|
)
|
|
op.create_index('topic_index', 'tags', ['topic', 'tag'], unique=False)
|
|
op.create_table('topics',
|
|
sa.Column('topic', sa.Unicode(length=25), nullable=False),
|
|
sa.Column('title', sa.Unicode(length=25), nullable=False),
|
|
sa.PrimaryKeyConstraint('topic', name=op.f('pk_topics')),
|
|
sa.UniqueConstraint('title', name=op.f('uq_topics_title'))
|
|
)
|
|
op.create_index(op.f('ix_entries_tag'), 'entries', ['tag'], unique=False)
|
|
op.create_index(op.f('ix_entries_topic'), 'entries', ['topic'], unique=False)
|
|
# ### end Alembic commands ###
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index(op.f('ix_entries_topic'), table_name='entries')
|
|
op.drop_index(op.f('ix_entries_tag'), table_name='entries')
|
|
op.drop_table('topics')
|
|
op.drop_index('topic_index', table_name='tags')
|
|
op.drop_table('tags')
|
|
# ### end Alembic commands ###
|