Files
LWLT-AIBOT/control-plane/migrations/007_task_source.sql
2026-08-25 10:33:29 +08:00

13 lines
350 B
SQL

ALTER TABLE tasks
ADD COLUMN IF NOT EXISTS source text NOT NULL DEFAULT 'manual';
ALTER TABLE tasks
DROP CONSTRAINT IF EXISTS tasks_source_check;
ALTER TABLE tasks
ADD CONSTRAINT tasks_source_check
CHECK (source IN ('manual', 'agentbus'));
CREATE INDEX IF NOT EXISTS tasks_source_idx
ON tasks (organization_id, source, created_at DESC);