"""add-flexfield-table

Revision ID: c239f4080b5c
Revises: a97dabbd44f4
Create Date: 2016-11-15 11:40:19.663751

"""

# revision identifiers, used by Alembic.
revision = 'c239f4080b5c'
down_revision = 'a97dabbd44f4'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


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.create_table('flex_field',
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('flex_field_id', sa.Integer(), nullable=False),
    sa.Column('submission_id', sa.Integer(), nullable=False),
    sa.Column('job_id', sa.Integer(), nullable=False),
    sa.Column('row_number', sa.Integer(), nullable=False),
    sa.Column('header', sa.Text(), nullable=True),
    sa.Column('cell', sa.Text(), nullable=True),
    sa.PrimaryKeyConstraint('flex_field_id')
    )
    op.create_index(op.f('ix_flex_field_job_id'), 'flex_field', ['job_id'], unique=False)
    op.create_index(op.f('ix_flex_field_submission_id'), 'flex_field', ['submission_id'], unique=False)
    ### end Alembic commands ###


def downgrade_data_broker():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_flex_field_submission_id'), table_name='flex_field')
    op.drop_index(op.f('ix_flex_field_job_id'), table_name='flex_field')
    op.drop_table('flex_field')
    ### end Alembic commands ###

