"""Remove file_request table

Revision ID: 4ebc7a781b31
Revises: 3c16b4d8506c
Create Date: 2019-07-25 10:24:40.326643

"""

# revision identifiers, used by Alembic.
revision = '4ebc7a781b31'
down_revision = '3c16b4d8506c'
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.drop_table('file_request')
    # ### end Alembic commands ###


def downgrade_data_broker():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('file_request',
    sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.Column('updated_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.Column('file_request_id', sa.INTEGER(), nullable=False),
    sa.Column('request_date', sa.DATE(), autoincrement=False, nullable=False),
    sa.Column('job_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('parent_job_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('start_date', sa.DATE(), autoincrement=False, nullable=False),
    sa.Column('end_date', sa.DATE(), autoincrement=False, nullable=False),
    sa.Column('agency_code', sa.TEXT(), autoincrement=False, nullable=False),
    sa.Column('file_type', sa.TEXT(), autoincrement=False, nullable=False),
    sa.Column('is_cached_file', sa.BOOLEAN(), autoincrement=False, nullable=False),
    sa.Column('agency_type', postgresql.ENUM('awarding', 'funding', name='agency_types', create_type=False), server_default=sa.text("'awarding'::agency_types"), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['job_id'], ['job.job_id'], name='fk_file_request_job_id', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('file_request_id', name='file_request_pkey')
    )
    # ### end Alembic commands ###

