pyfedi/migrations/versions/251be00ae302_follow_requests.py

50 lines
1.6 KiB
Python

"""follow requests
Revision ID: 251be00ae302
Revises: 01107dfe5a29
Create Date: 2023-09-08 19:07:51.474128
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '251be00ae302'
down_revision = '01107dfe5a29'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('community_join_request',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('community_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['community_id'], ['community.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('user_follow_request',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('follow_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['follow_id'], ['user.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('id')
)
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_user_ap_profile_id'), ['ap_profile_id'], 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_ap_profile_id'))
op.drop_table('user_follow_request')
op.drop_table('community_join_request')
# ### end Alembic commands ###