"""empty message

Revision ID: 01badaf21fe7
Revises: 
Create Date: 2019-04-11 13:35:38.718963

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

# revision identifiers, used by Alembic.
revision = '01badaf21fe7'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('database',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=256), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_database_name'), 'database', ['name'], unique=False)
    op.create_table('search',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=256), nullable=True),
    sa.Column('citation_list', mysql.LONGTEXT(), nullable=True),
    sa.Column('search_string', sa.String(length=512), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_search_name'), 'search', ['name'], unique=True)
    op.create_index(op.f('ix_search_search_string'), 'search', ['search_string'], unique=True)
    op.create_table('article',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('pmid', sa.Integer(), nullable=True),
    sa.Column('mesh', sa.Text(), nullable=True),
    sa.Column('doi', sa.String(length=256), nullable=True),
    sa.Column('pii', sa.String(length=256), nullable=True),
    sa.Column('abstract', mysql.LONGTEXT(charset='utf8mb4'), nullable=True),
    sa.Column('title', mysql.LONGTEXT(), nullable=True),
    sa.Column('date', sa.String(length=16), nullable=True),
    sa.Column('volume', sa.Integer(), nullable=True),
    sa.Column('authors', mysql.LONGTEXT(charset='utf8mb4'), nullable=True),
    sa.Column('journal', sa.String(length=512), nullable=True),
    sa.Column('mesh_qualifier', mysql.LONGTEXT(), nullable=True),
    sa.Column('search_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['search_id'], ['search.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_article_doi'), 'article', ['doi'], unique=False)
    op.create_index(op.f('ix_article_journal'), 'article', ['journal'], unique=False)
    op.create_index(op.f('ix_article_pii'), 'article', ['pii'], unique=False)
    op.create_index(op.f('ix_article_pmid'), 'article', ['pmid'], unique=False)
    op.create_table('result',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=256), nullable=True),
    sa.Column('freq_mesh_terms', mysql.LONGTEXT(), nullable=True),
    sa.Column('tfidf_mesh_terms', mysql.LONGTEXT(), nullable=True),
    sa.Column('freq_tiabs_uni_terms', mysql.LONGTEXT(), nullable=True),
    sa.Column('freq_tiabs_bi_terms', mysql.LONGTEXT(), nullable=True),
    sa.Column('tfidf_tiabs_uni_terms', mysql.LONGTEXT(), nullable=True),
    sa.Column('tfidf_tiabs_bi_terms', mysql.LONGTEXT(), nullable=True),
    sa.Column('tfidf_uniquecount_preds', mysql.LONGTEXT(), nullable=True),
    sa.Column('tfidf_multicount_preds', mysql.LONGTEXT(), nullable=True),
    sa.Column('fishers_uniquecount_preds', mysql.LONGTEXT(), nullable=True),
    sa.Column('fishers_multicount_preds', mysql.LONGTEXT(), nullable=True),
    sa.Column('chi_uniquecount_preds', mysql.LONGTEXT(), nullable=True),
    sa.Column('chi_multicount_preds', mysql.LONGTEXT(), nullable=True),
    sa.Column('search_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['search_id'], ['search.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('article_databases',
    sa.Column('article_id', sa.Integer(), nullable=False),
    sa.Column('database_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['article_id'], ['article.id'], ),
    sa.ForeignKeyConstraint(['database_id'], ['database.id'], ),
    sa.PrimaryKeyConstraint('article_id', 'database_id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('article_databases')
    op.drop_table('result')
    op.drop_index(op.f('ix_article_pmid'), table_name='article')
    op.drop_index(op.f('ix_article_pii'), table_name='article')
    op.drop_index(op.f('ix_article_journal'), table_name='article')
    op.drop_index(op.f('ix_article_doi'), table_name='article')
    op.drop_table('article')
    op.drop_index(op.f('ix_search_search_string'), table_name='search')
    op.drop_index(op.f('ix_search_name'), table_name='search')
    op.drop_table('search')
    op.drop_index(op.f('ix_database_name'), table_name='database')
    op.drop_table('database')
    # ### end Alembic commands ###
