mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
60 lines
2.1 KiB
Python
60 lines
2.1 KiB
Python
|
"""mod log
|
||
|
|
||
|
Revision ID: ea5a07acf23c
|
||
|
Revises: 5bee0ac7d99f
|
||
|
Create Date: 2024-07-06 14:47:40.409922
|
||
|
|
||
|
"""
|
||
|
from alembic import op
|
||
|
import sqlalchemy as sa
|
||
|
|
||
|
|
||
|
# revision identifiers, used by Alembic.
|
||
|
revision = 'ea5a07acf23c'
|
||
|
down_revision = '5bee0ac7d99f'
|
||
|
branch_labels = None
|
||
|
depends_on = None
|
||
|
|
||
|
|
||
|
def upgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.create_table('mod_log',
|
||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||
|
sa.Column('user_id', sa.Integer(), nullable=True),
|
||
|
sa.Column('community_id', sa.Integer(), nullable=True),
|
||
|
sa.Column('type', sa.String(length=10), nullable=True),
|
||
|
sa.Column('action', sa.String(length=30), nullable=True),
|
||
|
sa.Column('reason', sa.String(length=512), nullable=True),
|
||
|
sa.Column('link', sa.String(length=512), nullable=True),
|
||
|
sa.Column('link_text', sa.String(length=512), nullable=True),
|
||
|
sa.Column('public', sa.Boolean(), nullable=True),
|
||
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
||
|
sa.ForeignKeyConstraint(['community_id'], ['community.id'], ),
|
||
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||
|
sa.PrimaryKeyConstraint('id')
|
||
|
)
|
||
|
with op.batch_alter_table('mod_log', schema=None) as batch_op:
|
||
|
batch_op.create_index(batch_op.f('ix_mod_log_community_id'), ['community_id'], unique=False)
|
||
|
batch_op.create_index(batch_op.f('ix_mod_log_user_id'), ['user_id'], unique=False)
|
||
|
|
||
|
with op.batch_alter_table('site', schema=None) as batch_op:
|
||
|
batch_op.add_column(sa.Column('show_inoculation_block', sa.Boolean(), nullable=True))
|
||
|
|
||
|
# ### end Alembic commands ###
|
||
|
|
||
|
op.execute(sa.DDL('UPDATE "site" SET show_inoculation_block = true'))
|
||
|
|
||
|
|
||
|
|
||
|
def downgrade():
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
with op.batch_alter_table('site', schema=None) as batch_op:
|
||
|
batch_op.drop_column('show_inoculation_block')
|
||
|
|
||
|
with op.batch_alter_table('mod_log', schema=None) as batch_op:
|
||
|
batch_op.drop_index(batch_op.f('ix_mod_log_user_id'))
|
||
|
batch_op.drop_index(batch_op.f('ix_mod_log_community_id'))
|
||
|
|
||
|
op.drop_table('mod_log')
|
||
|
# ### end Alembic commands ###
|