Proposed migration
SQLLoading SQL…
Supabase migration review
A customer can edit their own orders. This migration logs each edit to an audit table. That table has row-level security enabled and no client insert policy.
Loading SQL…
A trigger function runs with the caller’s permissions by default. The customer can update the order, but the audit table rejects the insert. Both writes are in one transaction, so the order edit rolls back too.
The trigger now runs with its owner’s permissions and a pinned search path. The customer can save the order without receiving direct write access to the audit table.
Run from your project root. The default check reads local SQL files.