caterium-app/supabase/migrations
pavlov346346-source ab6d41ba0e
Some checks failed
Caterium QA / qa (push) Has been cancelled
feat: server-side order audit log for company owners
Owners/admins can now see, on the Аккаунт settings tab, a
tamper-proof journal of who created, edited or deleted each order
and when — including employees who have orders.* permissions. It is
written from inside sun_save_app_state itself (which already
diffs orders server-side for permission checks), so it can't be
spoofed or wiped by the client, unlike the old per-browser
'История изменений' list which only covered the current device and
had a 'Clear history' button anyone could press.

- New table public.sun_order_audit_log (workspace, order id, action,
  actor, summary, details), locked down to security-definer writes
  only — no client insert/update/delete policy exists.
- New RPC sun_list_order_audit(workspace, limit), admin-only.
- New settings card 'Журнал заказов' reading it, admin-only,
  classified into the existing Аккаунт settings tab.
- Verified end-to-end against a local PGlite instance: create/edit/
  delete each produce one correctly-attributed row, and a non-admin
  member is denied read access.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 18:56:39 +03:00
..
20260917150000_fresh_caterium.sql Restore Caterium schema and switch production to fresh Supabase 2026-09-17 17:30:57 +03:00
20260917193000_account_sidebar_brand.sql Separate account sidebar identity from company document branding 2026-09-17 19:51:01 +03:00
20260917221500_import_order_history.sql Preserve imported order history and saved order pricing 2026-09-17 20:15:32 +03:00
20260918000000_conflict_http_status.sql Return HTTP 409 for business conflicts to prevent PostgREST retry loops 2026-09-18 02:52:44 +03:00
20260918010000_trial_demo_catalog.sql Add isolated trial demo boxes with TTK, stock and purchasing scenario 2026-09-18 03:24:43 +03:00
20260918060000_trial_banquet.sql feat: add photos for the 34 training-catalog items that had none 2026-09-22 17:00:45 +03:00
20260918083000_trial_extras.sql feat: add photos for the 34 training-catalog items that had none 2026-09-22 17:00:45 +03:00
20260920104500_workspace_sidebar_brand.sql Fix employee sync and expose mobile profile/logout (#37) 2026-09-20 13:55:56 +03:00
20260922110319_public_basic_signup.sql Align Basic signup migration with Supabase history 2026-09-22 19:04:33 +08:00
20260922110544_public_signup_policy_security.sql Track public signup policy security migration 2026-09-22 19:06:05 +08:00
20260922120000_order_audit_log.sql feat: server-side order audit log for company owners 2026-09-22 18:56:39 +03:00