"""empty message

Revision ID: 7df0e563c8b6
Revises: 567107b7ef4e
Create Date: 2018-12-15 03:03:25.321996

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = '7df0e563c8b6'
down_revision = '567107b7ef4e'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('candidate', sa.Column('address', sa.String(length=100), nullable=False))
    op.add_column('candidate', sa.Column('email', sa.String(length=120), nullable=False))
    op.add_column('candidate', sa.Column('name', sa.String(length=100), nullable=False))
    op.add_column('candidate', sa.Column('phone', sa.String(length=100), nullable=False))
    op.add_column('candidate', sa.Column('plan_id', sa.Integer(), nullable=False))
    op.add_column('candidate', sa.Column('position', sa.String(length=100), nullable=False))
    op.create_unique_constraint(None, 'candidate', ['email'])
    op.drop_constraint('candidate_user_id_fkey', 'candidate', type_='foreignkey')
    op.create_foreign_key(None, 'candidate', 'plan', ['plan_id'], ['id'])
    op.drop_column('candidate', 'title')
    op.drop_column('candidate', 'user_id')
    op.drop_column('candidate', 'date_posted')
    op.drop_column('candidate', 'content')
    op.add_column('plan', sa.Column('date_end', sa.DateTime(), nullable=False))
    op.add_column('plan', sa.Column('date_start', sa.DateTime(), nullable=False))
    op.drop_constraint('plan_user_id_fkey', 'plan', type_='foreignkey')
    op.drop_column('plan', 'date_posted')
    op.drop_column('plan', 'user_id')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('plan', sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=False))
    op.add_column('plan', sa.Column('date_posted', postgresql.TIMESTAMP(), autoincrement=False, nullable=False))
    op.create_foreign_key('plan_user_id_fkey', 'plan', 'user', ['user_id'], ['id'])
    op.drop_column('plan', 'date_start')
    op.drop_column('plan', 'date_end')
    op.add_column('candidate', sa.Column('content', sa.TEXT(), autoincrement=False, nullable=False))
    op.add_column('candidate', sa.Column('date_posted', postgresql.TIMESTAMP(), autoincrement=False, nullable=False))
    op.add_column('candidate', sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=False))
    op.add_column('candidate', sa.Column('title', sa.VARCHAR(length=100), autoincrement=False, nullable=False))
    op.drop_constraint(None, 'candidate', type_='foreignkey')
    op.create_foreign_key('candidate_user_id_fkey', 'candidate', 'user', ['user_id'], ['id'])
    op.drop_constraint(None, 'candidate', type_='unique')
    op.drop_column('candidate', 'position')
    op.drop_column('candidate', 'plan_id')
    op.drop_column('candidate', 'phone')
    op.drop_column('candidate', 'name')
    op.drop_column('candidate', 'email')
    op.drop_column('candidate', 'address')
    # ### end Alembic commands ###
