diff --git a/internal/db/start/templates/_supabase.sql b/internal/db/start/templates/_supabase.sql index d391166a2..c339d2b61 100644 --- a/internal/db/start/templates/_supabase.sql +++ b/internal/db/start/templates/_supabase.sql @@ -5,11 +5,6 @@ CREATE DATABASE _supabase WITH OWNER postgres; -- Create schemas in _supabase database for -- internals tools and reports to not overload user database -- with non-user activity -CREATE SCHEMA IF NOT EXISTS _realtime; -ALTER SCHEMA _realtime OWNER TO postgres; -CREATE SCHEMA IF NOT EXISTS realtime; -ALTER SCHEMA realtime OWNER TO postgres; - CREATE SCHEMA IF NOT EXISTS _analytics; ALTER SCHEMA _analytics OWNER TO postgres; diff --git a/internal/db/start/templates/schema.sql b/internal/db/start/templates/schema.sql index 2ff6cf48f..534dd1207 100644 --- a/internal/db/start/templates/schema.sql +++ b/internal/db/start/templates/schema.sql @@ -12,6 +12,9 @@ ALTER USER supabase_storage_admin WITH PASSWORD :'pgpass'; ALTER USER supabase_replication_admin WITH PASSWORD :'pgpass'; ALTER USER supabase_read_only_user WITH PASSWORD :'pgpass'; +create schema if not exists _realtime; +alter schema _realtime owner to postgres; + BEGIN; -- Create pg_net extension diff --git a/internal/start/start.go b/internal/start/start.go index 413b8e2ed..72f34b8e7 100644 --- a/internal/start/start.go +++ b/internal/start/start.go @@ -750,7 +750,7 @@ EOF fmt.Sprintf("DB_PORT=%d", dbConfig.Port), "DB_USER=supabase_admin", "DB_PASSWORD=" + dbConfig.Password, - "DB_NAME=_supabase", + "DB_NAME=" + dbConfig.Database, "DB_AFTER_CONNECT_QUERY=SET search_path TO _realtime", "DB_ENC_KEY=" + utils.Config.Realtime.EncryptionKey, "API_JWT_SECRET=" + utils.Config.Auth.JwtSecret,