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

16 lines
522 B
SQL

ALTER TABLE organizations
ADD COLUMN IF NOT EXISTS automation_enabled boolean NOT NULL DEFAULT false;
ALTER TABLE tasks
ADD COLUMN IF NOT EXISTS confirmation_mode text NOT NULL DEFAULT 'manual';
ALTER TABLE tasks
DROP CONSTRAINT IF EXISTS tasks_confirmation_mode_check;
ALTER TABLE tasks
ADD CONSTRAINT tasks_confirmation_mode_check
CHECK (confirmation_mode IN ('manual', 'automatic'));
CREATE INDEX IF NOT EXISTS tasks_confirmation_mode_idx
ON tasks (organization_id, confirmation_mode, created_at DESC);