Files
Hy2026/backend/migrations/0003_demo_schema.surql
Rafał Tyński dcaa1a77db fix(sql): make audit_log context field flexible
Allow nested keys in audit_log.context (SCHEMAFULL rejected free-form context like user.read/consent.grant metadata).
2026-10-04 02:12:00 +02:00

17 lines
1.0 KiB
Plaintext

-- TarninaHub — migration 0003: additive schema for demo/UI
-- Idempotent, additive. Required before the demo seed (0004).
-- Human-friendly label for synthetic demo profiles (never personal data).
DEFINE FIELD IF NOT EXISTS display_name ON TABLE user TYPE option<string>;
-- Innovations are taggable (matchmaking filters), mirroring `problem.tags`.
DEFINE FIELD IF NOT EXISTS tags ON TABLE innovation TYPE array<record<tag>> DEFAULT [];
-- Free-form payloads must be FLEXIBLE (SCHEMAFULL otherwise rejects nested keys).
DEFINE FIELD OVERWRITE contact ON TABLE organization TYPE option<object> FLEXIBLE;
DEFINE FIELD OVERWRITE content ON TABLE application TYPE object FLEXIBLE DEFAULT {};
DEFINE FIELD OVERWRITE media ON TABLE innovation TYPE array<object> FLEXIBLE DEFAULT [];
DEFINE FIELD OVERWRITE attachments ON TABLE knowledge_item TYPE array<object> FLEXIBLE DEFAULT [];
DEFINE FIELD OVERWRITE payload ON TABLE notification TYPE object FLEXIBLE DEFAULT {};
DEFINE FIELD OVERWRITE context ON TABLE audit_log TYPE object FLEXIBLE DEFAULT {};