On April 21, we are restricting certain SQL actions you can perform in your database’s auth
, storage
, and realtime
schemas.
Why Are We Making These Restrictions?
Supabase Auth, Storage, and Realtime services each rely on their respective schemas in order to function properly.
These restrictions prevent unintended side effects like third-party tooling and user defined changes altering schemas or their objects, such as migration tables and database functions, that could disrupt or break functionality.
What This Means for Your Project?
On April 21, you will no longer be able to perform the following actions on the auth
, storage
, and realtime
schemas:
- Create tables and database functions
- Drop existing tables or database functions
- Create indexes on existing tables
- Perform destructive actions (i.e.
INSERT
,UPDATE
,DELETE
,TRUNCATE
) on the following migration tables:auth.schema_migrations
storage.migrations
realtime.schema_migrations
However, you will still have permissions to perform the following actions:
- Create foreign keys referencing tables in the
auth
,storage
, andrealtime
schemas - Create RLS policies and database triggers on the following tables:
auth.audit_log_entries
auth.identities
auth.refresh_tokens
auth.sessions
auth.users
storage.buckets
storage.migrations
storage.objects
storage.s3_multipart_uploads
storage.s3_multipart_uploads_parts
realtime.messages
How to Determine If You’re Affected?
- Run the following query to check if you created any tables in the
auth
,storage
, andrealtime
schemas:
_13SELECT relnamespace::regnamespace || '.' || relname AS table_name_13FROM pg_class _13WHERE _13 (relnamespace = 'auth'::regnamespace AND relowner != 'supabase_auth_admin'::regrole) _13 OR (relnamespace = 'storage'::regnamespace AND relowner != 'supabase_storage_admin'::regrole) _13 OR ( _13 relnamespace = 'realtime'::regnamespace_13 AND relowner NOT IN ( _13 SELECT oid _13 FROM pg_roles _13 WHERE rolname IN ('supabase_admin', 'supabase_realtime_admin') _13 ) _13 );
- Run the following query to check if you created any database functions in the
auth
,storage
, andrealtime
schemas:
_13SELECT pronamespace::regnamespace || '.' || proname AS function_name_13FROM pg_proc _13WHERE _13 (pronamespace = 'auth'::regnamespace AND proowner != 'supabase_auth_admin'::regrole) _13 OR (pronamespace = 'storage'::regnamespace AND proowner != 'supabase_storage_admin'::regrole) _13 OR ( _13 pronamespace = 'realtime'::regnamespace _13 AND proowner NOT IN ( _13 SELECT oid _13 FROM pg_roles _13 WHERE rolname IN ('supabase_admin', 'supabase_realtime_admin') _13 ) _13 );
If any of the above queries return a result, you must move them to either the public
schema or a schema that you’ve created. Otherwise, they will be deleted.
- Here’s how you can move a table to another schema:
_10ALTER TABLE storage.my_custom_table SET SCHEMA my_custom_schema;
- Here’s how you can move a database function to another schema:
_10ALTER FUNCTION storage.custom_function SET SCHEMA my_custom_schema;