"""add officers to task order

Revision ID: 71cbe76c3b87
Revises: 91bd9482ce23
Create Date: 2019-01-04 10:16:50.062349

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = '71cbe76c3b87'
down_revision = '91bd9482ce23'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('task_orders', sa.Column('cor_id', postgresql.UUID(as_uuid=True), nullable=True))
    op.add_column('task_orders', sa.Column('ko_id', postgresql.UUID(as_uuid=True), nullable=True))
    op.add_column('task_orders', sa.Column('so_id', postgresql.UUID(as_uuid=True), nullable=True))
    op.create_foreign_key('task_orders_users_so_id', 'task_orders', 'users', ['so_id'], ['id'])
    op.create_foreign_key('task_orders_users_cor_id', 'task_orders', 'users', ['cor_id'], ['id'])
    op.create_foreign_key('task_orders_users_ko_id', 'task_orders', 'users', ['ko_id'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint('task_orders_users_so_id', 'task_orders', type_='foreignkey')
    op.drop_constraint('task_orders_users_cor_id', 'task_orders', type_='foreignkey')
    op.drop_constraint('task_orders_users_ko_id', 'task_orders', type_='foreignkey')
    op.drop_column('task_orders', 'so_id')
    op.drop_column('task_orders', 'ko_id')
    op.drop_column('task_orders', 'cor_id')
    # ### end Alembic commands ###
