"""deep learning added models

Revision ID: 8f6baba4a236
Revises: cdbaf30dfba7
Create Date: 2021-06-06 15:30:52.159084

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '8f6baba4a236'
down_revision = 'cdbaf30dfba7'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('model_basic',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('model_name', sa.String(length=50), nullable=False),
    sa.Column('model_dataset', sa.Integer(), nullable=True),
    sa.Column('model_type', sa.Integer(), nullable=False),
    sa.Column('target_class', sa.String(length=50), nullable=False),
    sa.Column('created_on', sa.DateTime(), server_default=sa.text('now()'), nullable=True),
    sa.Column('updated_on', sa.DateTime(), server_default=sa.text('now()'), nullable=True),
    sa.ForeignKeyConstraint(['model_dataset'], ['data_file.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('model_configs',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('parameter', sa.String(length=50), nullable=False),
    sa.Column('value', sa.String(length=50), nullable=False),
    sa.Column('model_id', sa.Integer(), nullable=True),
    sa.Column('created_on', sa.DateTime(), server_default=sa.text('now()'), nullable=True),
    sa.Column('updated_on', sa.DateTime(), server_default=sa.text('now()'), nullable=True),
    sa.ForeignKeyConstraint(['model_id'], ['model_basic.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('model_results',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('model_id', sa.Integer(), nullable=True),
    sa.Column('epoc', sa.Integer(), nullable=False),
    sa.Column('iteration', sa.Integer(), nullable=False),
    sa.Column('metric', sa.String(length=50), nullable=False),
    sa.Column('value', sa.Float(), nullable=False),
    sa.ForeignKeyConstraint(['model_id'], ['model_basic.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


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