ograph/packages/engine/migrations/0016_reaction_actions.sql
小橘 d84a860d15 feat: initial ograph repo — engine (85 tests) + cli (31 tests)
Extracted from uncaged monorepo (oc-xiaoju/uncaged).
Resolves oc-xiaoju/uncaged#224.

- @uncaged/ograph: CF Worker engine (events, projections, reactions)
- @uncaged/ograph-cli: CLI for managing OGraph instances
- Removed @uncaged/oid dependency (unused)
- 116 tests, all passing
- CI: GitHub Actions

小橘 🍊(NEKO Team)
2026-04-12 23:43:56 +00:00

18 lines
812 B
SQL

-- Add action type support to reactions (Phase 2: emit_event)
-- Pre-launch: drop and recreate reactions table
DROP TABLE IF EXISTS reactions;
CREATE TABLE reactions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
projection_def_hash TEXT NOT NULL REFERENCES projection_def_versions(hash),
params_hash TEXT NOT NULL,
params TEXT NOT NULL,
action TEXT NOT NULL DEFAULT 'webhook', -- 'webhook' | 'emit_event'
webhook_url TEXT, -- required when action = 'webhook'
emit_event_type TEXT, -- required when action = 'emit_event'
emit_payload_template TEXT, -- JSONata: optional template for emit_event
created_at INTEGER NOT NULL DEFAULT (unixepoch() * 1000)
);
CREATE INDEX idx_reactions_projection ON reactions(projection_def_hash, params_hash);