"""empty message

Revision ID: 929ee310ba2a
Revises: 686c749b249b
Create Date: 2020-02-25 14:44:32.396118

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '929ee310ba2a'
down_revision = '686c749b249b'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('lists',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_table('vehicules')
    op.drop_table('drivers')
    op.add_column('todos', sa.Column('list_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'todos', 'lists', ['list_id'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'todos', type_='foreignkey')
    op.drop_column('todos', 'list_id')
    op.create_table('drivers',
    sa.Column('id', sa.INTEGER(), server_default=sa.text("nextval('drivers_id_seq'::regclass)"), autoincrement=True, nullable=False),
    sa.Column('name', sa.VARCHAR(), autoincrement=False, nullable=False),
    sa.PrimaryKeyConstraint('id', name='drivers_pkey'),
    postgresql_ignore_search_path=False
    )
    op.create_table('vehicules',
    sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
    sa.Column('name', sa.VARCHAR(), autoincrement=False, nullable=False),
    sa.Column('driver_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['driver_id'], ['drivers.id'], name='vehicules_driver_id_fkey'),
    sa.PrimaryKeyConstraint('id', name='vehicules_pkey')
    )
    op.drop_table('lists')
    # ### end Alembic commands ###
