"""empty message

Revision ID: bcbaf7a9f0a8
Revises: 93bec8e22a70
Create Date: 2019-01-17 21:58:02.814823

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'bcbaf7a9f0a8'
down_revision = '93bec8e22a70'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('places',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('student_id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(), nullable=False),
    sa.Column('used_as_meetup', sa.Integer(), nullable=True),
    sa.Column('used_as_dropoff', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['student_id'], ['students.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column('lessons', sa.Column('dropoff_place_id', sa.Integer(), nullable=False))
    op.add_column('lessons', sa.Column('meetup_place_id', sa.Integer(), nullable=False))
    op.create_foreign_key(None, 'lessons', 'places', ['meetup_place_id'], ['id'])
    op.create_foreign_key(None, 'lessons', 'places', ['dropoff_place_id'], ['id'])
    op.drop_column('lessons', 'meetup')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('lessons', sa.Column('meetup', sa.VARCHAR(), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'lessons', type_='foreignkey')
    op.drop_constraint(None, 'lessons', type_='foreignkey')
    op.drop_column('lessons', 'meetup_place_id')
    op.drop_column('lessons', 'dropoff_place_id')
    op.drop_table('places')
    # ### end Alembic commands ###
