mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-24 11:51:27 -08:00
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
"""sub topics
|
|
|
|
Revision ID: a88efa63415b
|
|
Revises: 2629cf0e2965
|
|
Create Date: 2024-03-01 19:18:49.137449
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy_searchable import sync_trigger, drop_trigger
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = 'a88efa63415b'
|
|
down_revision = '2629cf0e2965'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('topic', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('parent_id', sa.Integer(), nullable=True))
|
|
|
|
conn = op.get_bind()
|
|
sync_trigger(conn, 'community', 'search_vector', ['name', 'title', 'description', 'rules'])
|
|
sync_trigger(conn, 'user', 'search_vector', ['user_name', 'about', 'keywords'])
|
|
sync_trigger(conn, 'post', 'search_vector', ['title', 'body'])
|
|
sync_trigger(conn, 'post_reply', 'search_vector', ['body'])
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('topic', schema=None) as batch_op:
|
|
batch_op.drop_column('parent_id')
|
|
|
|
conn = op.get_bind()
|
|
drop_trigger(conn, 'community', 'search_vector')
|
|
drop_trigger(conn, 'user', 'search_vector')
|
|
drop_trigger(conn, 'post', 'search_vector')
|
|
drop_trigger(conn, 'post_reply', 'search_vector')
|
|
# ### end Alembic commands ###
|