generated from coulomb/repo-seed
feat(tasks): adopt canonical task statuses
This commit is contained in:
@@ -29,7 +29,7 @@ def upgrade() -> None:
|
||||
"active", "blocked", "completed", "archived", name="workstreamstatus", create_type=True
|
||||
)
|
||||
task_status = postgresql.ENUM(
|
||||
"todo", "in_progress", "blocked", "done", "cancelled", name="taskstatus", create_type=True
|
||||
"wait", "todo", "progress", "done", "cancel", name="taskstatus", create_type=True
|
||||
)
|
||||
task_priority = postgresql.ENUM(
|
||||
"low", "medium", "high", "critical", name="taskpriority", create_type=True
|
||||
|
||||
57
migrations/versions/a4v5w6x7y8z9_task_status_canon.py
Normal file
57
migrations/versions/a4v5w6x7y8z9_task_status_canon.py
Normal file
@@ -0,0 +1,57 @@
|
||||
"""adapt task status enum to InfoTechCanon task lifecycle
|
||||
|
||||
Revision ID: a4v5w6x7y8z9
|
||||
Revises: z3u4v5w6x7y8
|
||||
Create Date: 2026-05-25
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
revision = "a4v5w6x7y8z9"
|
||||
down_revision = "z3u4v5w6x7y8"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute("ALTER TABLE tasks ALTER COLUMN status DROP DEFAULT")
|
||||
op.execute("ALTER TYPE taskstatus RENAME TO taskstatus_old")
|
||||
op.execute("CREATE TYPE taskstatus AS ENUM ('wait', 'todo', 'progress', 'done', 'cancel')")
|
||||
op.execute(
|
||||
"""
|
||||
ALTER TABLE tasks
|
||||
ALTER COLUMN status TYPE taskstatus
|
||||
USING (
|
||||
CASE status::text
|
||||
WHEN 'blocked' THEN 'wait'
|
||||
WHEN 'in_progress' THEN 'progress'
|
||||
WHEN 'cancelled' THEN 'cancel'
|
||||
ELSE status::text
|
||||
END
|
||||
)::taskstatus
|
||||
"""
|
||||
)
|
||||
op.execute("ALTER TABLE tasks ALTER COLUMN status SET DEFAULT 'todo'")
|
||||
op.execute("DROP TYPE taskstatus_old")
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.execute("ALTER TABLE tasks ALTER COLUMN status DROP DEFAULT")
|
||||
op.execute("ALTER TYPE taskstatus RENAME TO taskstatus_new")
|
||||
op.execute("CREATE TYPE taskstatus AS ENUM ('todo', 'in_progress', 'blocked', 'done', 'cancelled')")
|
||||
op.execute(
|
||||
"""
|
||||
ALTER TABLE tasks
|
||||
ALTER COLUMN status TYPE taskstatus
|
||||
USING (
|
||||
CASE status::text
|
||||
WHEN 'wait' THEN 'blocked'
|
||||
WHEN 'progress' THEN 'in_progress'
|
||||
WHEN 'cancel' THEN 'cancelled'
|
||||
ELSE status::text
|
||||
END
|
||||
)::taskstatus
|
||||
"""
|
||||
)
|
||||
op.execute("ALTER TABLE tasks ALTER COLUMN status SET DEFAULT 'todo'")
|
||||
op.execute("DROP TYPE taskstatus_new")
|
||||
Reference in New Issue
Block a user