chatdesk-ui/storage_v1.19.1/migrations/tenant/0035-add-insert-trigger-pre...

8 lines
310 B
SQL

-- This trigger is used to create the hierarchy of prefixes
-- When writing directly in the prefixes table
CREATE OR REPLACE TRIGGER "prefixes_create_hierarchy"
BEFORE INSERT ON "storage"."prefixes"
FOR EACH ROW
WHEN (pg_trigger_depth() < 1)
EXECUTE FUNCTION "storage"."prefixes_insert_trigger"();