"""Add archived column to tasks

Revision ID: ac244fdc928b
Revises: 49110ac3912f
Create Date: 2023-10-04 16:33:03.779858

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "ac244fdc928b"
down_revision = "49110ac3912f"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "tasks",
        sa.Column("archived", sa.Boolean(), nullable=True),
    )
    op.execute("UPDATE tasks SET archived=False")
    op.alter_column(
        "tasks",
        "archived",
        existing_type=sa.Boolean(),
        nullable=False,
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("tasks", "archived")
    # ### end Alembic commands ###
