"""empty message

Revision ID: 061f935d05e8
Revises: 00d8ee05f87b
Create Date: 2018-09-29 14:52:08.877838

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '061f935d05e8'
down_revision = '00d8ee05f87b'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('academic_year',
    sa.Column('year', sa.String(length=5), nullable=False),
    sa.Column('start_date', sa.DateTime(), nullable=False),
    sa.Column('end_date', sa.DateTime(), nullable=False),
    sa.PrimaryKeyConstraint('year')
    )
    op.create_table('admin',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('last_notification_check', sa.DateTime(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('domain',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('domain', sa.String(length=30), nullable=False),
    sa.Column('description', sa.String(length=120), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('faq',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('question', sa.String(length=120), nullable=False),
    sa.Column('answer', sa.Text(), nullable=True),
    sa.Column('rank', sa.Integer(), nullable=True),
    sa.Column('external', sa.Boolean(), nullable=True),
    sa.Column('student', sa.Boolean(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('skill',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=30), nullable=False),
    sa.Column('description', sa.String(length=120), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('status',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=30), nullable=False),
    sa.Column('domain_id', sa.Integer(), nullable=False),
    sa.Column('action_text', sa.String(length=10), nullable=False),
    sa.Column('css_class', sa.String(length=10), nullable=False),
    sa.ForeignKeyConstraint(['domain_id'], ['domain.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_status_domain_id'), 'status', ['domain_id'], unique=False)
    op.create_table('alert_queue',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('email', sa.String(length=60), nullable=False),
    sa.Column('created_date', sa.DateTime(), nullable=False),
    sa.Column('sent_date', sa.DateTime(), nullable=True),
    sa.Column('subject', sa.String(length=120), nullable=False),
    sa.Column('message_text', sa.Text(), nullable=False),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_alert_queue_created_date'), 'alert_queue', ['created_date'], unique=False)
    op.create_index(op.f('ix_alert_queue_sent_date'), 'alert_queue', ['sent_date'], unique=False)
    op.create_index(op.f('ix_alert_queue_user_id'), 'alert_queue', ['user_id'], unique=False)
    op.create_table('project',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=120), nullable=False),
    sa.Column('client_id', sa.Integer(), nullable=False),
    sa.Column('created_date', sa.DateTime(), nullable=True),
    sa.Column('updated_date', sa.DateTime(), nullable=True),
    sa.Column('academic_year', sa.String(length=5), nullable=False),
    sa.Column('overview', sa.Text(), nullable=True),
    sa.Column('deliverables', sa.Text(), nullable=True),
    sa.Column('resources', sa.Text(), nullable=True),
    sa.Column('status_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['academic_year'], ['academic_year.year'], ),
    sa.ForeignKeyConstraint(['client_id'], ['users.id'], ),
    sa.ForeignKeyConstraint(['status_id'], ['status.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_project_academic_year'), 'project', ['academic_year'], unique=False)
    op.create_index(op.f('ix_project_client_id'), 'project', ['client_id'], unique=False)
    op.create_index(op.f('ix_project_status_id'), 'project', ['status_id'], unique=False)
    op.create_table('skill_offered',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('skill_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['skill_id'], ['skill.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_skill_offered_skill_id'), 'skill_offered', ['skill_id'], unique=False)
    op.create_index(op.f('ix_skill_offered_user_id'), 'skill_offered', ['user_id'], unique=False)
    op.create_table('transition',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('from_status_id', sa.Integer(), nullable=False),
    sa.Column('to_status_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['from_status_id'], ['status.id'], ),
    sa.ForeignKeyConstraint(['to_status_id'], ['status.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_transition_from_status_id'), 'transition', ['from_status_id'], unique=False)
    op.create_index(op.f('ix_transition_to_status_id'), 'transition', ['to_status_id'], unique=False)
    op.create_table('flag',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('project_id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('message', sa.Text(), nullable=True),
    sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_flag_project_id'), 'flag', ['project_id'], unique=False)
    op.create_index(op.f('ix_flag_user_id'), 'flag', ['user_id'], unique=False)
    op.create_table('interest',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('project_id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('created_date', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_interest_project_id'), 'interest', ['project_id'], unique=False)
    op.create_index(op.f('ix_interest_user_id'), 'interest', ['user_id'], unique=False)
    op.create_table('skill_required',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('project_id', sa.Integer(), nullable=False),
    sa.Column('skill_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
    sa.ForeignKeyConstraint(['skill_id'], ['skill.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_skill_required_project_id'), 'skill_required', ['project_id'], unique=False)
    op.create_index(op.f('ix_skill_required_skill_id'), 'skill_required', ['skill_id'], unique=False)
    op.create_table('team',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('project_id', sa.Integer(), nullable=False),
    sa.Column('created_by', sa.Integer(), nullable=False),
    sa.Column('created_date', sa.DateTime(), nullable=True),
    sa.Column('updated_date', sa.DateTime(), nullable=True),
    sa.Column('status_id', sa.Integer(), nullable=False),
    sa.Column('comment', sa.Text(), nullable=True),
    sa.Column('vacancies', sa.Text(), nullable=True),
    sa.ForeignKeyConstraint(['created_by'], ['users.id'], ),
    sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
    sa.ForeignKeyConstraint(['status_id'], ['status.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_team_created_by'), 'team', ['created_by'], unique=False)
    op.create_index(op.f('ix_team_project_id'), 'team', ['project_id'], unique=False)
    op.create_index(op.f('ix_team_status_id'), 'team', ['status_id'], unique=False)
    op.create_table('team_member',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('team_id', sa.Integer(), nullable=False),
    sa.Column('created_date', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['team_id'], ['team.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_team_member_team_id'), 'team_member', ['team_id'], unique=False)
    op.create_index(op.f('ix_team_member_user_id'), 'team_member', ['user_id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_team_member_user_id'), table_name='team_member')
    op.drop_index(op.f('ix_team_member_team_id'), table_name='team_member')
    op.drop_table('team_member')
    op.drop_index(op.f('ix_team_status_id'), table_name='team')
    op.drop_index(op.f('ix_team_project_id'), table_name='team')
    op.drop_index(op.f('ix_team_created_by'), table_name='team')
    op.drop_table('team')
    op.drop_index(op.f('ix_skill_required_skill_id'), table_name='skill_required')
    op.drop_index(op.f('ix_skill_required_project_id'), table_name='skill_required')
    op.drop_table('skill_required')
    op.drop_index(op.f('ix_interest_user_id'), table_name='interest')
    op.drop_index(op.f('ix_interest_project_id'), table_name='interest')
    op.drop_table('interest')
    op.drop_index(op.f('ix_flag_user_id'), table_name='flag')
    op.drop_index(op.f('ix_flag_project_id'), table_name='flag')
    op.drop_table('flag')
    op.drop_index(op.f('ix_transition_to_status_id'), table_name='transition')
    op.drop_index(op.f('ix_transition_from_status_id'), table_name='transition')
    op.drop_table('transition')
    op.drop_index(op.f('ix_skill_offered_user_id'), table_name='skill_offered')
    op.drop_index(op.f('ix_skill_offered_skill_id'), table_name='skill_offered')
    op.drop_table('skill_offered')
    op.drop_index(op.f('ix_project_status_id'), table_name='project')
    op.drop_index(op.f('ix_project_client_id'), table_name='project')
    op.drop_index(op.f('ix_project_academic_year'), table_name='project')
    op.drop_table('project')
    op.drop_index(op.f('ix_alert_queue_user_id'), table_name='alert_queue')
    op.drop_index(op.f('ix_alert_queue_sent_date'), table_name='alert_queue')
    op.drop_index(op.f('ix_alert_queue_created_date'), table_name='alert_queue')
    op.drop_table('alert_queue')
    op.drop_index(op.f('ix_status_domain_id'), table_name='status')
    op.drop_table('status')
    op.drop_table('skill')
    op.drop_table('faq')
    op.drop_table('domain')
    op.drop_table('admin')
    op.drop_table('academic_year')
    # ### end Alembic commands ###
