"""empty message

Revision ID: 8d31109c41cb
Revises: 
Create Date: 2020-09-18 13:01:44.627501

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('psycologists',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('email', sa.String(length=20), nullable=True),
    sa.Column('password', sa.String(length=50), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email')
    )
    op.create_table('roles',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=80), nullable=True),
    sa.Column('description', sa.String(length=255), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('unf_questions',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('q_title', sa.String(length=100), nullable=False),
    sa.Column('q_desc', sa.String(length=300), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_unf_questions_timestamp'), 'unf_questions', ['timestamp'], unique=False)
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('email', sa.String(length=100), nullable=True),
    sa.Column('password', sa.String(length=255), nullable=True),
    sa.Column('active', sa.Boolean(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email')
    )
    op.create_table('fil_questions',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('q_title', sa.String(length=100), nullable=False),
    sa.Column('q_desc', sa.String(length=300), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('ans_text', sa.String(length=200), nullable=True),
    sa.Column('psy_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['psy_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_fil_questions_ans_text'), 'fil_questions', ['ans_text'], unique=False)
    op.create_index(op.f('ix_fil_questions_timestamp'), 'fil_questions', ['timestamp'], unique=False)
    op.create_table('profile',
    sa.Column('psy_id', sa.Integer(), nullable=True),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=25), nullable=True),
    sa.Column('about_me', sa.String(length=100), nullable=True),
    sa.Column('phno', sa.Integer(), nullable=True),
    sa.Column('address', sa.String(length=200), nullable=True),
    sa.ForeignKeyConstraint(['psy_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('roles_users',
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('role_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], )
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('roles_users')
    op.drop_table('profile')
    op.drop_index(op.f('ix_fil_questions_timestamp'), table_name='fil_questions')
    op.drop_index(op.f('ix_fil_questions_ans_text'), table_name='fil_questions')
    op.drop_table('fil_questions')
    op.drop_table('users')
    op.drop_index(op.f('ix_unf_questions_timestamp'), table_name='unf_questions')
    op.drop_table('unf_questions')
    op.drop_table('roles')
    op.drop_table('psycologists')
    # ### end Alembic commands ###
