45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
|
"""empty message
|
||
|
|
||
|
Revision ID: 377be1608b45
|
||
|
Revises: e4b6bbf83a3e
|
||
|
Create Date: 2023-06-07 12:39:19.989484
|
||
|
|
||
|
"""
|
||
|
from alembic import op
|
||
|
import sqlalchemy as sa
|
||
|
|
||
|
|
||
|
# revision identifiers, used by Alembic.
|
||
|
revision = '377be1608b45'
|
||
|
down_revision = 'e4b6bbf83a3e'
|
||
|
branch_labels = None
|
||
|
depends_on = None
|
||
|
|
||
|
|
||
|
def upgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.create_table('typeahead',
|
||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||
|
sa.Column('category', sa.String(length=255), nullable=True),
|
||
|
sa.Column('search_term', sa.String(length=255), nullable=True),
|
||
|
sa.Column('result', sa.JSON(), nullable=True),
|
||
|
sa.Column('updated_at_in_seconds', sa.Integer(), nullable=True),
|
||
|
sa.Column('created_at_in_seconds', sa.Integer(), nullable=True),
|
||
|
sa.PrimaryKeyConstraint('id')
|
||
|
)
|
||
|
with op.batch_alter_table('typeahead', schema=None) as batch_op:
|
||
|
batch_op.create_index(batch_op.f('ix_typeahead_category'), ['category'], unique=False)
|
||
|
batch_op.create_index(batch_op.f('ix_typeahead_search_term'), ['search_term'], unique=False)
|
||
|
|
||
|
# ### end Alembic commands ###
|
||
|
|
||
|
|
||
|
def downgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
with op.batch_alter_table('typeahead', schema=None) as batch_op:
|
||
|
batch_op.drop_index(batch_op.f('ix_typeahead_search_term'))
|
||
|
batch_op.drop_index(batch_op.f('ix_typeahead_category'))
|
||
|
|
||
|
op.drop_table('typeahead')
|
||
|
# ### end Alembic commands ###
|