pyfedi/migrations/versions/f8200275644a_community_ban_field.py

49 lines
1.6 KiB
Python
Raw Normal View History

2023-09-17 21:19:51 +12:00
"""community ban field
Revision ID: f8200275644a
Revises: 6b84580a94cd
Create Date: 2023-09-16 19:21:13.085722
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f8200275644a'
down_revision = '6b84580a94cd'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('community_member', schema=None) as batch_op:
batch_op.add_column(sa.Column('is_banned', sa.Boolean(), nullable=True))
with op.batch_alter_table('post', schema=None) as batch_op:
batch_op.add_column(sa.Column('comments_enabled', sa.Boolean(), nullable=True))
with op.batch_alter_table('post_reply', schema=None) as batch_op:
batch_op.add_column(sa.Column('body_html_safe', sa.Boolean(), nullable=True))
batch_op.add_column(sa.Column('ap_create_id', sa.String(length=100), nullable=True))
batch_op.add_column(sa.Column('ap_announce_id', sa.String(length=100), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('post_reply', schema=None) as batch_op:
batch_op.drop_column('ap_announce_id')
batch_op.drop_column('ap_create_id')
batch_op.drop_column('body_html_safe')
with op.batch_alter_table('post', schema=None) as batch_op:
batch_op.drop_column('comments_enabled')
with op.batch_alter_table('community_member', schema=None) as batch_op:
batch_op.drop_column('is_banned')
# ### end Alembic commands ###