mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
56 lines
2 KiB
Python
56 lines
2 KiB
Python
"""add user.deleted and indexes
|
|
|
|
Revision ID: 1a9507704262
|
|
Revises: 54f1dd40e066
|
|
Create Date: 2023-08-05 21:09:39.158879
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '1a9507704262'
|
|
down_revision = '54f1dd40e066'
|
|
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_id'), ['ap_id'], unique=False)
|
|
batch_op.create_index(batch_op.f('ix_community_name'), ['name'], unique=False)
|
|
|
|
with op.batch_alter_table('post', schema=None) as batch_op:
|
|
batch_op.create_index(batch_op.f('ix_post_ap_id'), ['ap_id'], unique=False)
|
|
|
|
with op.batch_alter_table('post_reply', schema=None) as batch_op:
|
|
batch_op.create_index(batch_op.f('ix_post_reply_ap_id'), ['ap_id'], unique=False)
|
|
|
|
with op.batch_alter_table('user', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('deleted', sa.Boolean(), nullable=True))
|
|
batch_op.create_index(batch_op.f('ix_user_ap_id'), ['ap_id'], unique=False)
|
|
batch_op.create_index(batch_op.f('ix_user_last_seen'), ['last_seen'], unique=False)
|
|
|
|
# ### 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_index(batch_op.f('ix_user_last_seen'))
|
|
batch_op.drop_index(batch_op.f('ix_user_ap_id'))
|
|
batch_op.drop_column('deleted')
|
|
|
|
with op.batch_alter_table('post_reply', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_post_reply_ap_id'))
|
|
|
|
with op.batch_alter_table('post', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_post_ap_id'))
|
|
|
|
with op.batch_alter_table('community', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_community_name'))
|
|
batch_op.drop_index(batch_op.f('ix_community_ap_id'))
|
|
|
|
# ### end Alembic commands ###
|