supabase-postgres.git / summary / log / commit / refs
commit 0b94f202ec1b4c90b102bd30f9ce4ea77fbcdb79
Author: Paul Cioanca <paul.cioanca@supabase.io>
Commit: GitHub <noreply@github.com>
Date: Thu Sep 12 14:02:08 2024 +0000
fix: continue running migrations when auth.uid/auth.role/auth.email are missing in the database (#1187)
.../20211124212715_update-auth-owner.sql | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/migrations/db/migrations/20211124212715_update-auth-owner.sql b/migrations/db/migrations/20211124212715_update-auth-owner.sql
index d40609c5..2bce808b 100644
--- a/migrations/db/migrations/20211124212715_update-auth-owner.sql
+++ b/migrations/db/migrations/20211124212715_update-auth-owner.sql
@@ -1,8 +1,24 @@
-- migrate:up
-- update owner for auth.uid, auth.role and auth.email functions
-ALTER FUNCTION auth.uid owner to supabase_auth_admin;
-ALTER FUNCTION auth.role owner to supabase_auth_admin;
-ALTER FUNCTION auth.email owner to supabase_auth_admin;
+DO $$
+BEGIN
+ ALTER FUNCTION auth.uid owner to supabase_auth_admin;
+EXCEPTION WHEN OTHERS THEN
+ RAISE WARNING 'Error encountered when changing owner of auth.uid to supabase_auth_admin';
+END $$;
+DO $$
+BEGIN
+ ALTER FUNCTION auth.role owner to supabase_auth_admin;
+EXCEPTION WHEN OTHERS THEN
+ RAISE WARNING 'Error encountered when changing owner of auth.role to supabase_auth_admin';
+END $$;
+
+DO $$
+BEGIN
+ ALTER FUNCTION auth.email owner to supabase_auth_admin;
+EXCEPTION WHEN OTHERS THEN
+ RAISE WARNING 'Error encountered when changing owner of auth.email to supabase_auth_admin';
+END $$;
-- migrate:down
[parent: 03537cedfbe9]