mirror of
https://github.com/supabase/supabase.git
synced 2026-09-22 13:37:53 +08:00
22ae9a2caf
* feat(db): error table updating function Add a function for updating the error table (to be used for syncing the repo contents to the database). * feat(db): add function to delete unused error codes Add a DB function to delete any unused error codes (actually a soft delete due to a rule on the content.error table). This allows syncing the repo state to the DB state by removing any entries that have been removed from the repo.
17 lines
437 B
PL/PgSQL
17 lines
437 B
PL/PgSQL
create or replace function content.delete_error_codes_except(
|
|
skip_codes jsonb
|
|
)
|
|
returns void
|
|
set search_path = ''
|
|
language sql
|
|
as $$
|
|
delete from content.error
|
|
where not exists (
|
|
select 1
|
|
from jsonb_array_elements(skip_codes) skipped
|
|
join content.service on service.name = (skipped ->> 'service')
|
|
where service.id = error.service
|
|
and error.code = (skipped ->> 'error_code')
|
|
);
|
|
$$;
|