"""relate stdout to trace

Revision ID: 5a08750d6760
Revises: de90b787e92f
Create Date: 2022-03-16 19:01:00.628340

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = '5a08750d6760'
down_revision = 'de90b787e92f'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('stdout', schema=None) as batch_op:
        batch_op.add_column(sa.Column('trace_no', sa.Integer(), nullable=False))
        batch_op.add_column(sa.Column('trace_id', sa.Integer(), nullable=False))
        batch_op.create_foreign_key(
            batch_op.f('fk_stdout_trace_id_trace'), 'trace', ['trace_id'], ['id']
        )

    # ### end Alembic commands ###


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

    # ### end Alembic commands ###
