microblog.pub/alembic/versions/2022_08_14_1638-9bc69ed947e...

41 wiersze
1.2 KiB
Python

"""New conversation field
Revision ID: 9bc69ed947e2
Revises: 1702e88016db
Create Date: 2022-08-14 16:38:37.688377+00:00
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '9bc69ed947e2'
down_revision = '1702e88016db'
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('conversation', sa.String(), nullable=True))
with op.batch_alter_table('outbox', schema=None) as batch_op:
batch_op.add_column(sa.Column('conversation', sa.String(), nullable=True))
op.execute("UPDATE inbox SET conversation = ap_context")
op.execute("UPDATE outbox SET conversation = ap_context")
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('outbox', schema=None) as batch_op:
batch_op.drop_column('conversation')
with op.batch_alter_table('inbox', schema=None) as batch_op:
batch_op.drop_column('conversation')
# ### end Alembic commands ###