"""add engunits to container

Revision ID: 0a75990ce423
Revises: 46b7d2bb5ebe
Create Date: 2022-05-04 21:49:33.755044

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '0a75990ce423'
down_revision = '46b7d2bb5ebe'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('containers', schema=None) as batch_op:
        batch_op.add_column(sa.Column('volume_engunit_id', sa.Integer(), nullable=True))
        batch_op.create_foreign_key('fk_engunits_id_containers', 'engunits', ['volume_engunit_id'], ['id'])

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('containers', schema=None) as batch_op:
        batch_op.drop_constraint(None, type_='foreignkey')
        batch_op.drop_column('volume_engunit_id')

    # ### end Alembic commands ###
