pyfedi/migrations/versions/88d210da7f2b_user_matrix_id.py

41 lines
1.3 KiB
Python
Raw Normal View History

2023-12-28 21:00:26 +13:00
"""user matrix id
Revision ID: 88d210da7f2b
Revises: e8113bc01e3a
Create Date: 2023-12-28 20:51:08.605373
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '88d210da7f2b'
down_revision = 'e8113bc01e3a'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('report', schema=None) as batch_op:
batch_op.drop_constraint('report_suspect_reply_id_fkey', type_='foreignkey')
batch_op.drop_column('suspect_reply_id')
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.add_column(sa.Column('matrix_user_id', sa.String(length=256), nullable=True))
# ### 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_column('matrix_user_id')
with op.batch_alter_table('report', schema=None) as batch_op:
batch_op.add_column(sa.Column('suspect_reply_id', sa.INTEGER(), autoincrement=False, nullable=True))
batch_op.create_foreign_key('report_suspect_reply_id_fkey', 'post_reply', ['suspect_reply_id'], ['id'])
# ### end Alembic commands ###