Skip to content

Commit 0b94f20

Browse files
authored
fix: continue running migrations when auth.uid/auth.role/auth.email are missing in the database (#1187)
1 parent 03537ce commit 0b94f20

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed
Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
-- migrate:up
22

33
-- update owner for auth.uid, auth.role and auth.email functions
4-
ALTER FUNCTION auth.uid owner to supabase_auth_admin;
5-
ALTER FUNCTION auth.role owner to supabase_auth_admin;
6-
ALTER FUNCTION auth.email owner to supabase_auth_admin;
4+
DO $$
5+
BEGIN
6+
ALTER FUNCTION auth.uid owner to supabase_auth_admin;
7+
EXCEPTION WHEN OTHERS THEN
8+
RAISE WARNING 'Error encountered when changing owner of auth.uid to supabase_auth_admin';
9+
END $$;
710

11+
DO $$
12+
BEGIN
13+
ALTER FUNCTION auth.role owner to supabase_auth_admin;
14+
EXCEPTION WHEN OTHERS THEN
15+
RAISE WARNING 'Error encountered when changing owner of auth.role to supabase_auth_admin';
16+
END $$;
17+
18+
DO $$
19+
BEGIN
20+
ALTER FUNCTION auth.email owner to supabase_auth_admin;
21+
EXCEPTION WHEN OTHERS THEN
22+
RAISE WARNING 'Error encountered when changing owner of auth.email to supabase_auth_admin';
23+
END $$;
824
-- migrate:down

0 commit comments

Comments
 (0)