pyfedi/migrations/versions/f52c490d4e81_indexable_fields_controls_external_.py

45 lines
1.4 KiB
Python
Raw Normal View History

"""indexable fields - controls external search
Revision ID: f52c490d4e81
Revises: e8fe5eff9532
Create Date: 2023-08-26 13:09:31.328816
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f52c490d4e81'
down_revision = 'e8fe5eff9532'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('community', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_community_ap_profile_id'), ['ap_profile_id'], unique=False)
with op.batch_alter_table('post', schema=None) as batch_op:
batch_op.add_column(sa.Column('indexable', sa.Boolean(), nullable=True))
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.add_column(sa.Column('indexable', sa.Boolean(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.drop_column('indexable')
with op.batch_alter_table('post', schema=None) as batch_op:
batch_op.drop_column('indexable')
with op.batch_alter_table('community', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_community_ap_profile_id'))
# ### end Alembic commands ###