open-law/migrations/versions/4f49ff89f7b8_updated_by.py

35 lines
939 B
Python

"""updated_by
Revision ID: 4f49ff89f7b8
Revises: 94ee8daa0c25
Create Date: 2023-06-20 14:46:26.950182
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4f49ff89f7b8'
down_revision = '94ee8daa0c25'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('book_versions', schema=None) as batch_op:
batch_op.add_column(sa.Column('updated_by', sa.Integer(), nullable=True))
batch_op.create_foreign_key(None, 'users', ['updated_by'], ['id'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('book_versions', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
batch_op.drop_column('updated_by')
# ### end Alembic commands ###