-- v1.1.5: extend the triggers framework to recognise `files` as the -- fifth concrete kind (after `kv`/`dead_letter` v1.1.1, `docs` v1.1.2, -- `cron` v1.1.4). Mirrors the 0014/0017 extensions exactly: two CHECK -- constraints widen (strictly gaining `'files'`), one new detail table. -- -- Files rows route through the SAME generic dispatcher path as the -- other event kinds (single match-arm extension on the Rust side). The -- only new machinery is the FilesServiceImpl emitting ServiceEvents -- that the OutboxEventEmitter fans out — identical to KV/docs. -- Extend triggers.kind to include 'files'. No existing row carries a -- value outside the widened set, so the drop+add is safe. ALTER TABLE triggers DROP CONSTRAINT triggers_kind_check; ALTER TABLE triggers ADD CONSTRAINT triggers_kind_check CHECK (kind IN ('kv', 'dead_letter', 'docs', 'cron', 'files')); -- Extend outbox.source_kind to include 'files'. ALTER TABLE outbox DROP CONSTRAINT outbox_source_kind_check; ALTER TABLE outbox ADD CONSTRAINT outbox_source_kind_check CHECK (source_kind IN ('http', 'kv', 'dead_letter', 'docs', 'cron', 'files')); -- One row per files trigger. Mirrors kv_trigger_details: -- collection_glob — "*", "exact", or "prefix*" -- ops — subset of {create, update, delete}, empty = any CREATE TABLE files_trigger_details ( trigger_id UUID PRIMARY KEY REFERENCES triggers(id) ON DELETE CASCADE, collection_glob TEXT NOT NULL, ops TEXT[] NOT NULL );