36 lines
892 B
Python
36 lines
892 B
Python
"""task_kind column on notes: distinguishes plan-tasks from work-tasks
|
|
|
|
Revision ID: 0056
|
|
Revises: 0055
|
|
Create Date: 2026-05-28
|
|
|
|
A plan is a Task (a note with non-null status) marked task_kind='plan'.
|
|
The CHECK constraint lands in the same migration as the value set, per the
|
|
'new CHECK-enum values need a same-change migration' rule.
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
revision = "0056"
|
|
down_revision = "0055"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column(
|
|
"notes",
|
|
sa.Column(
|
|
"task_kind", sa.Text(), nullable=False, server_default="work",
|
|
),
|
|
)
|
|
op.create_check_constraint(
|
|
"notes_task_kind_check", "notes", "task_kind IN ('work','plan')",
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_constraint("notes_task_kind_check", "notes", type_="check")
|
|
op.drop_column("notes", "task_kind")
|