Column level change validation with supabase?

Hey,

We are using Postgres and supabase is a god send for us. RLS with Security Definer functions has been working well, but we had one security concern.

There are some columns like status and status updated at, we will only want the status_updated_at to change only when status is changed. Currently we are using database trigger to enforce the rule, but we soon found that we would need triggers on most tables. Is it efficient? Mostly it is just simple comparisons with old and new value.

We really don’t want to introduce a backend layer, though most of our business logic is portable.

Anyone who has done similar validation, is there any downside to it? Any unintended consequences, or you found out that it was hard to maintain and decided backend layer will be easier?

Posted May 10, 2024, 7:00 PM UTC

12
Loading comments…