fix(db): add FK constraints, indexes, transaction fixes, and hook_executions tenant isolation (migrations 082-083) (#1246)

Co-authored-by: Bruno Clermont <bruno.clermont@gmail.com>
This commit is contained in:
Bruno ClermontandBruno Clermont authored and GitHub committed 2026-06-21 10:13:35 +07:00
1 parent c31dd21934
commit 756c4dce71
12 files changed
+397 -27

No files matched your search

+1
View File
@@ -438,6 +438,7 @@ func (d *stdDispatcher) writeExec(ctx context.Context, cfg HookConfig, ev Event,
exec := HookExecution{
ID: uuid.New(),
HookID: &hookID,
TenantID: &ev.TenantID,
SessionID: ev.SessionID,
Event: ev.HookEvent,
InputHash: inputHash,
+2 -1
View File
@@ -186,7 +186,8 @@ type HookConfig struct {
// error_detail (BYTEA) is AES-256-GCM encrypted before storage.
type HookExecution struct {
ID uuid.UUID `json:"id"`
HookID *uuid.UUID `json:"hook_id,omitempty"` // NULL when hook deleted (ON DELETE SET NULL)
HookID *uuid.UUID `json:"hook_id,omitempty"` // NULL when hook deleted (ON DELETE SET NULL)
TenantID *uuid.UUID `json:"tenant_id,omitempty"`
SessionID string `json:"session_id"`
Event HookEvent `json:"event"`
InputHash string `json:"input_hash"` // canonical-JSON sha256, 64 hex chars