-- §11.6 / §4.5: SHARED-collection triggers.
--
-- A §11.6 shared collection is group-owned and written by any subtree app via
-- the `kv::shared_collection(...)` handles. Until now such writes fired NO
-- trigger (the "group trigger has no app to watch" deferral): the per-app
-- trigger dispatch keys on the writer app's OWN collections, and a shared
-- collection lives in a distinct group-keyed store.
--
-- A SHARED trigger closes that gap: a group-owned trigger template marked
-- `shared = true` watches the group's shared collection (not per-app
-- collections). On a shared-collection write the emitter matches these triggers
-- by the OWNING GROUP's chain and runs the handler under the WRITER app
-- (`cx.app_id`) — the same "group template runs under the firing app" model.
--
-- The `shared` marker is the namespace boundary: a `shared = false` trigger
-- (the default, incl. every existing row) watches per-app collections exactly
-- as before; a `shared = true` trigger watches shared collections only. The two
-- never cross (the per-app match queries add `AND t.shared = FALSE`, the shared
-- match queries `AND t.shared = TRUE`).

ALTER TABLE triggers ADD COLUMN shared BOOLEAN NOT NULL DEFAULT FALSE;
