"""add delay

Revision ID: 25ed0f563bdc
Revises: ddebc53e7879
Create Date: 2023-12-18 14:41:50.210994

"""
from datetime import datetime
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '25ed0f563bdc'
down_revision: Union[str, None] = 'ddebc53e7879'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('rosemary_tasks', sa.Column('delay', sa.DateTime(), nullable=True))
    op.execute(
        'UPDATE rosemary_tasks SET delay = now()'
    )
    op.alter_column('rosemary_tasks', 'delay', nullable=False)
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('rosemary_tasks', 'delay')
    # ### end Alembic commands ###
