"""empty message

Revision ID: 97e2275a9d34
Revises: 913348fc7fe8
Create Date: 2020-12-04 01:05:31.497265

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '97e2275a9d34'
down_revision = '913348fc7fe8'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('user_courses')
    op.drop_table('course_materials')
    op.drop_table('message_history')
    op.drop_table('teacher_courses')
    op.drop_table('course_questions')
    op.drop_table('courses')
    op.drop_table('course_question_answer')
    op.drop_table('user')
    op.drop_table('teacher')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('teacher',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('first_name', sa.VARCHAR(length=20), nullable=False),
    sa.Column('last_name', sa.VARCHAR(length=20), nullable=False),
    sa.Column('email', sa.VARCHAR(length=50), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('user',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('email', sa.VARCHAR(length=50), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('course_question_answer',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('course_id', sa.INTEGER(), nullable=True),
    sa.Column('question', sa.VARCHAR(length=1000), nullable=False),
    sa.Column('answer', sa.VARCHAR(length=1000), nullable=False),
    sa.ForeignKeyConstraint(['course_id'], ['courses.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('courses',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('code', sa.VARCHAR(length=10), nullable=False),
    sa.Column('course_name', sa.VARCHAR(length=20), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('course_questions',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('sender_id', sa.INTEGER(), nullable=True),
    sa.Column('course_id', sa.INTEGER(), nullable=True),
    sa.Column('message', sa.VARCHAR(length=1000), nullable=False),
    sa.Column('created_on', sa.TIMESTAMP(), nullable=False),
    sa.ForeignKeyConstraint(['course_id'], ['courses.id'], ),
    sa.ForeignKeyConstraint(['sender_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('teacher_courses',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('teacher_id', sa.INTEGER(), nullable=True),
    sa.Column('course_id', sa.INTEGER(), nullable=True),
    sa.ForeignKeyConstraint(['course_id'], ['courses.id'], ),
    sa.ForeignKeyConstraint(['teacher_id'], ['teacher.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('message_history',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('course_id', sa.INTEGER(), nullable=True),
    sa.Column('receiver_id', sa.INTEGER(), nullable=True),
    sa.Column('sender_id', sa.INTEGER(), nullable=True),
    sa.Column('created_on', sa.TIMESTAMP(), nullable=False),
    sa.Column('message', sa.VARCHAR(length=1000), nullable=False),
    sa.ForeignKeyConstraint(['course_id'], ['courses.code'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('course_materials',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('course_id', sa.INTEGER(), nullable=True),
    sa.Column('data', sa.BLOB(), nullable=True),
    sa.ForeignKeyConstraint(['course_id'], ['courses.code'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('user_courses',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('user_id', sa.INTEGER(), nullable=True),
    sa.Column('course_id', sa.INTEGER(), nullable=True),
    sa.ForeignKeyConstraint(['course_id'], ['courses.code'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###
