pyfedi/migrations/versions/72f3326bdf54_site_settings.py

67 lines
2.6 KiB
Python
Raw Permalink Normal View History

"""site settings
Revision ID: 72f3326bdf54
Revises: 238faf5c9b8d
Create Date: 2023-12-16 20:22:16.446742
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '72f3326bdf54'
down_revision = '238faf5c9b8d'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('site',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=256), nullable=True),
sa.Column('description', sa.String(length=256), nullable=True),
sa.Column('icon_id', sa.Integer(), nullable=True),
sa.Column('sidebar', sa.Text(), nullable=True),
sa.Column('legal_information', sa.Text(), nullable=True),
sa.Column('public_key', sa.Text(), nullable=True),
sa.Column('private_key', sa.Text(), nullable=True),
sa.Column('enable_downvotes', sa.Boolean(), nullable=True),
sa.Column('allow_local_image_posts', sa.Boolean(), nullable=True),
sa.Column('remote_image_cache_days', sa.Integer(), nullable=True),
sa.Column('enable_nsfw', sa.Boolean(), nullable=True),
sa.Column('enable_nsfl', sa.Boolean(), nullable=True),
sa.Column('community_creation_admin_only', sa.Boolean(), nullable=True),
sa.Column('reports_email_admins', sa.Boolean(), nullable=True),
sa.Column('registration_mode', sa.String(length=20), nullable=True),
sa.Column('application_question', sa.Text(), nullable=True),
sa.Column('allow_or_block_list', sa.Integer(), nullable=True),
sa.Column('allowlist', sa.Text(), nullable=True),
sa.Column('blocklist', sa.Text(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('last_active', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['icon_id'], ['file.id'], ),
sa.PrimaryKeyConstraint('id')
)
with op.batch_alter_table('post', schema=None) as batch_op:
batch_op.add_column(sa.Column('reports', sa.Integer(), nullable=True))
with op.batch_alter_table('post_reply', schema=None) as batch_op:
batch_op.add_column(sa.Column('reports', sa.Integer(), 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('reports')
with op.batch_alter_table('post', schema=None) as batch_op:
batch_op.drop_column('reports')
op.drop_table('site')
# ### end Alembic commands ###