Skip to content

Settings & Audit Logs

settings

Table: public.settings

Column Type Default Description
id uuid PK UUID
key text NOT NULL Setting key
value jsonb NOT NULL Arbitrary value
description text nullable
updated_by uuid FK → profiles(id) nullable Last editor
created_at timestamptz now()
updated_at timestamptz now()

Unique constraint on key.

audit_logs

Table: public.audit_logs

Column Type Default Description
id bigint PK auto-increment
user_id uuid FK → profiles(id) nullable
action text NOT NULL INSERT, UPDATE, DELETE
entity_type text NOT NULL Table name
entity_id text NOT NULL Row UUID
old_values jsonb nullable Before state
new_values jsonb nullable After state
ip_address text nullable
created_at timestamptz now()

Indexes

  • Unique on settings(key)
  • idx_audit_logs_entity on audit_logs(entity_type, entity_id)
  • idx_audit_logs_user on audit_logs(user_id)
  • idx_audit_logs_created on audit_logs(created_at)