fix(db): migrations failing on a fresh supabase instance (#645)
* fix(db): add extension function wrappers (avoid shadowing gen_random_uuid) Signed-off-by: filip <filip.harald@gmail.com> * test: added test for extension function wrappers (uuid_generate_v4 and gen_random_bytes) in public schema, covering existence, delegation, correctness, properties, and idempotency. Signed-off-by: filip <filip.harald@gmail.com> --------- Signed-off-by: filip <filip.harald@gmail.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
CREATE SCHEMA IF NOT EXISTS extensions;
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA extensions;
|
||||
CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA extensions;
|
||||
|
||||
CREATE OR REPLACE FUNCTION public.uuid_generate_v4()
|
||||
RETURNS uuid
|
||||
LANGUAGE sql
|
||||
VOLATILE
|
||||
PARALLEL SAFE
|
||||
SET search_path = ''
|
||||
AS $$
|
||||
SELECT extensions.uuid_generate_v4();
|
||||
$$;
|
||||
|
||||
CREATE OR REPLACE FUNCTION public.gen_random_bytes(size integer)
|
||||
RETURNS bytea
|
||||
LANGUAGE sql
|
||||
VOLATILE
|
||||
PARALLEL SAFE
|
||||
SET search_path = ''
|
||||
AS $$
|
||||
SELECT extensions.gen_random_bytes(size);
|
||||
$$;
|
||||
|
||||
NOTIFY pgrst, 'reload schema';
|
||||
Reference in New Issue
Block a user