"""empty message

Revision ID: de0a86d7de49
Revises: e186faabdafe
Create Date: 2019-09-24 12:31:18.648835

"""

# revision identifiers, used by Alembic.
revision = "de0a86d7de49"
down_revision = "e186faabdafe"

from alembic import op
import sqlalchemy as sa


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column("composes", sa.Column("time_started", sa.DateTime(), nullable=True))
    # ### end Alembic commands ###
    # Set the start time for all composes that are not waiting.
    op.execute(
        "UPDATE composes SET time_started = time_submitted WHERE time_started IS NULL AND state != 0"
    )


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("composes", "time_started")
    # ### end Alembic commands ###
