-- Add is_anonymous column to tasks table for ephemeral task support -- Anonymous tasks don't belong to contracts and are automatically cleaned up after completion ALTER TABLE tasks ADD COLUMN IF NOT EXISTS is_anonymous BOOLEAN NOT NULL DEFAULT FALSE; -- Index for efficient cleanup queries (anonymous tasks that are completed) CREATE INDEX IF NOT EXISTS idx_tasks_anonymous_cleanup ON tasks(is_anonymous, status, completed_at) WHERE is_anonymous = TRUE; COMMENT ON COLUMN tasks.is_anonymous IS 'True for ephemeral one-off tasks that are not part of a contract and will be auto-cleaned up';