"""Update SQS for file generation caching refactor

Revision ID: 660c8c1a02e3
Revises: 8692ab1298e1
Create Date: 2018-10-30 23:03:09.465088

"""

# revision identifiers, used by Alembic.
revision = '660c8c1a02e3'
down_revision = '8692ab1298e1'
branch_labels = None
depends_on = None

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

def upgrade(engine_name):
    globals()["upgrade_%s" % engine_name]()


def downgrade(engine_name):
    globals()["downgrade_%s" % engine_name]()





def upgrade_data_broker():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('sqs', sa.Column('message', sa.Integer(), nullable=False))
    op.add_column('sqs', sa.Column('attributes', sa.Text(), nullable=True))
    op.drop_constraint('uniq_job_id', 'sqs', type_='unique')
    op.drop_column('sqs', 'agency_type')
    op.drop_column('sqs', 'job_id')
    op.drop_column('sqs', 'agency_code')
    # ### end Alembic commands ###


def downgrade_data_broker():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('sqs', sa.Column('agency_code', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column('sqs', sa.Column('job_id', sa.INTEGER(), autoincrement=False, nullable=False))
    op.add_column('sqs', sa.Column('agency_type', postgresql.ENUM('awarding', 'funding', name='agency_types'), autoincrement=False, nullable=True))
    op.create_unique_constraint('uniq_job_id', 'sqs', ['job_id'])
    op.drop_column('sqs', 'attributes')
    op.drop_column('sqs', 'message')
    # ### end Alembic commands ###

