"""add_basic_search_regression_support

Revision ID: 238e49d46a5d
Revises: 654843b2efc5
Create Date: 2016-08-23 09:46:17.304274

"""

# revision identifiers, used by Alembic.
revision = '238e49d46a5d'
down_revision = '654843b2efc5'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from sqlalchemy.schema import Sequence, CreateSequence

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('search_regression_queries',
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.Column('id', sa.BigInteger(), nullable=False),
    sa.Column('query', sa.Text(), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    op.execute(CreateSequence(Sequence('search_regression_query_id_seq'))),
    sa.UniqueConstraint('query')
    )
    op.create_table('search_assessment_results',
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.Column('id', sa.BigInteger(), nullable=False),
    sa.Column('query_id', sa.BigInteger(), nullable=False),
    sa.Column('build', sa.Text(), nullable=False),
    sa.Column('version', sa.BigInteger(), nullable=False),
    sa.Column('doc_ids', postgresql.ARRAY(sa.BigInteger()), nullable=False),
    sa.Column('results', postgresql.JSON(), nullable=False),
    sa.Column('scores', postgresql.ARRAY(sa.Numeric()), nullable=True),
    sa.ForeignKeyConstraint(['query_id'], ['search_regression_queries.id'], ),
    sa.PrimaryKeyConstraint('id'),
    op.execute(CreateSequence(Sequence('search_assessment_result_id_seq')))
    )
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('search_assessment_results')
    op.drop_table('search_regression_queries')
    ### end Alembic commands ###
