"""Add InboxObject.has_local_mention Revision ID: 604d125ea2fb Revises: 5d3e3f2b9b4e Create Date: 2022-08-19 12:46:22.239989+00:00 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = '604d125ea2fb' down_revision = '5d3e3f2b9b4e' branch_labels = None depends_on = None def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### with op.batch_alter_table('inbox', schema=None) as batch_op: batch_op.add_column(sa.Column('has_local_mention', sa.Boolean(), server_default='0', nullable=False)) # ### end Alembic commands ### op.execute("UPDATE inbox SET has_local_mention = 1 WHERE id IN (select inbox_object_id from notifications where notification_type = 'MENTION')") def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### with op.batch_alter_table('inbox', schema=None) as batch_op: batch_op.drop_column('has_local_mention') # ### end Alembic commands ###