"""empty message

Revision ID: cc1869b1bfe0
Revises: fcb94d9cb42d
Create Date: 2020-05-18 17:19:06.761982

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'cc1869b1bfe0'
down_revision = 'fcb94d9cb42d'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    # Before making list_id required, setup the 'Uncategorized' list
    # Assign all Todo items to this new list
    op.execute('INSERT INTO todolists (id, name) VALUES (1, \'Uncategorized\');')
    op.execute('UPDATE todos SET list_id = 1;')
    op.alter_column('todos', 'list_id',
               existing_type=sa.INTEGER(),
               nullable=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('todos', 'list_id',
               existing_type=sa.INTEGER(),
               nullable=True)
    # ### end Alembic commands ###
