"""empty message

Revision ID: 226a309623db
Revises: 
Create Date: 2021-06-28 18:41:40.761076

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '226a309623db'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('counselor',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=255), nullable=False),
    sa.Column('firstname', sa.String(length=255), nullable=True),
    sa.Column('lastname', sa.String(length=255), nullable=True),
    sa.Column('phone_number', sa.String(length=255), nullable=True),
    sa.Column('email', sa.String(length=255), nullable=True),
    sa.Column('password', sa.String(length=255), nullable=True),
    sa.Column('degree', sa.String(length=255), nullable=True),
    sa.Column('score', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('username')
    )
    op.create_table('group',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=255), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('role',
    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('state',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=255), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('type',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=255), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=255), nullable=True),
    sa.Column('password', sa.String(length=255), nullable=True),
    sa.Column('firstname', sa.String(length=255), nullable=True),
    sa.Column('lastname', sa.String(length=255), nullable=True),
    sa.Column('phone_number', sa.String(length=255), nullable=True),
    sa.Column('email', sa.String(length=255), nullable=True),
    sa.Column('age', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('role_users',
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('role_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['role_id'], ['role.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
    )
    op.create_table('subgroup',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=255), nullable=True),
    sa.Column('group_foreignkey', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['group_foreignkey'], ['group.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('request',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('content', sa.String(length=255), nullable=True),
    sa.Column('title', sa.String(length=255), nullable=False),
    sa.Column('pub_date', sa.DateTime(), nullable=False),
    sa.Column('user_foreignkey', sa.Integer(), nullable=False),
    sa.Column('counselor_foreignkey', sa.Integer(), nullable=True),
    sa.Column('group_foreignkey', sa.Integer(), nullable=True),
    sa.Column('subgroup_foreignkey', sa.Integer(), nullable=True),
    sa.Column('state_foreignkey', sa.Integer(), nullable=True),
    sa.Column('type_foreignkey', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['counselor_foreignkey'], ['counselor.id'], ),
    sa.ForeignKeyConstraint(['group_foreignkey'], ['group.id'], ),
    sa.ForeignKeyConstraint(['state_foreignkey'], ['state.id'], ),
    sa.ForeignKeyConstraint(['subgroup_foreignkey'], ['subgroup.id'], ),
    sa.ForeignKeyConstraint(['type_foreignkey'], ['type.id'], ),
    sa.ForeignKeyConstraint(['user_foreignkey'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('payment',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('value', sa.Float(), nullable=False),
    sa.Column('pay_date', sa.DateTime(), nullable=False),
    sa.Column('call', sa.Boolean(), nullable=True),
    sa.Column('counselor_foreignkey', sa.Integer(), nullable=False),
    sa.Column('request_foreignkey', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['counselor_foreignkey'], ['user.id'], ),
    sa.ForeignKeyConstraint(['request_foreignkey'], ['request.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('respond',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('date', sa.DateTime(), nullable=False),
    sa.Column('content', sa.Text(), nullable=True),
    sa.Column('user_foreignkey', sa.Integer(), nullable=True),
    sa.Column('counselor_foreignkey', sa.Integer(), nullable=True),
    sa.Column('request_foreignkey', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['counselor_foreignkey'], ['counselor.id'], ),
    sa.ForeignKeyConstraint(['request_foreignkey'], ['request.id'], ),
    sa.ForeignKeyConstraint(['user_foreignkey'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('respond')
    op.drop_table('payment')
    op.drop_table('request')
    op.drop_table('subgroup')
    op.drop_table('role_users')
    op.drop_table('user')
    op.drop_table('type')
    op.drop_table('state')
    op.drop_table('role')
    op.drop_table('group')
    op.drop_table('counselor')
    # ### end Alembic commands ###
