postgres supabase_admin user not created in initial setup
Opened this issue · 3 comments
- [ x] I confirm this is a bug with Supabase, not with my own application.
- [ x] I confirm I have searched the [Docs]
Describe the bug
After upgrading db container to 15.8.1.020 database won't startup correctly complaining that supabase_adming role does not exist.
db starts up correctly with container 15.1.1.78
To Reproduce
- Delete all postgres database files
- change db container to 15.8.1.020 & startup your system
System information
I use the container in a kubernetes setup but it looks like a general problem with migrations/db/init-scripts/00000000000000-initial-schema.sql in the most recent commit
ab7f879
the line create user supabase_admin dissapeared (it was present before).
Additional context
I'm getting something similar while trying to use the migrate script to prepare my database for supabase. I've tried adding:
create user supabase_admin;
alter user supabase_admin password 'my_password';
alter user supabase_admin with superuser createdb createrole replication bypassrls;And the 'my_password' is just the password I'm using for my local postgres superuser, which I've set in the .env as POSTGRES_PASSWORD.
But does not make a difference. I'm doing this from scratch. Have just created a "supabase" database which I've set the POSTGRES_DB to.
To not mess with the local postgres user, I commented out the
ALTER ROLE postgres NOSUPERUSER CREATEDB CREATEROLE LOGIN REPLICATION BYPASSRLS;I instead added a supabase_admin as a superuser, and settled for running against the "postgres" database. I wanted to run on a different one, but I see that the postgres database is hard-coded in the migrate-script, instead of being taken from the envs, in the line alter database postgres owner to postgres. So I wanted to try running that first, and I figure I'll sort it out later if I get it working this way.
But the issue is now instead
./migrate.sh: running /Users/albin/Programmering/postgres/migrations/db/migrations/20250220051611_
pg_net_perms_fix.sql
CREATE FUNCTION
DO
./migrate.sh: running /Users/albin/Programmering/postgres/migrations/db/migrations/20250312095419_
pgbouncer_ownership.sql
psql:/Users/albin/Programmering/postgres/migrations/db/migrations/20250312095419_pgbouncer_ownersh
ip.sql:2: ERROR: schema "pgbouncer" does not existI've recently reset my database. I'll keep working at it and see if I can find some workaround. I tried adding the schema manually but then when running the supabase docker compose I'm back to that the analytics can't connect to the postgres, and since everything depends on the analytics being up, nothing works.
I think the reason for the analytics failing might be due to the fact that there's no _analytics schema in the database, and I can't find anywhere in the migrations that such a schema would be created either. The only place I can find the _analytics schema being referenced is in logs.sql in the supabase docker folder.
And there, I can only see it being used in the docker-compose setup when spinning up the supabase/postgres, and I'm not sure if there's some kind of flow/script to run this for an external database.