41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
"""add extraction info to submissions
|
|
|
|
Revision ID: afbdd9e46207
|
|
Revises: 8753ed70f148
|
|
Create Date: 2023-01-30 13:05:42.858306
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = 'afbdd9e46207'
|
|
down_revision = '8753ed70f148'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('_contacts', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('organization_id', sa.INTEGER(), nullable=True))
|
|
batch_op.create_foreign_key('fk_contact_org_id', '_organizations', ['organization_id'], ['id'], ondelete='SET NULL')
|
|
|
|
with op.batch_alter_table('_submissions', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('extraction_info', sa.JSON(), nullable=True))
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('_submissions', schema=None) as batch_op:
|
|
batch_op.drop_column('extraction_info')
|
|
|
|
with op.batch_alter_table('_contacts', schema=None) as batch_op:
|
|
batch_op.drop_constraint('fk_contact_org_id', type_='foreignkey')
|
|
batch_op.drop_column('organization_id')
|
|
|
|
# ### end Alembic commands ###
|