-- Phase 22: per-task description + URL + bidirectional copy linkage.
--
-- description / url default to '' so existing rows stay valid without a
-- backfill. linked_task_id is set on a *copy* and points at its source task;
-- the reverse direction is reached by `WHERE linked_task_id = ?`. ON DELETE
-- SET NULL keeps the copy alive when the source is deleted.

ALTER TABLE tasks ADD COLUMN description     TEXT NOT NULL DEFAULT '';
ALTER TABLE tasks ADD COLUMN url             TEXT NOT NULL DEFAULT '';
ALTER TABLE tasks ADD COLUMN linked_task_id  INTEGER REFERENCES tasks(id) ON DELETE SET NULL;

CREATE INDEX idx_tasks_linked ON tasks(linked_task_id);
