sbarbase
Contents

Database access

Each environment can give you a PostgreSQL connection string for migrations and tools: psql, pg_dump, Prisma, Drizzle and the like. It is off until an owner or admin turns it on.

Turn it on

  1. Open the environment's page in the console.
  2. Under Database, press Turn on database access.
  3. Copy the connection string it shows. The password is only shown once; New password replaces it, and the old one stops working.

The string looks like this:

postgresql://e_…_developer:<password>@127.0.0.1:6543/e_…

Connect from your computer

The address is on the server itself. Open an SSH tunnel, then use the string as it is:

ssh -N -L 6543:127.0.0.1:6543 you@your-server
psql "postgresql://e_…_developer:<password>@127.0.0.1:6543/e_…?sslmode=disable"

Examples:

psql "postgresql://…@127.0.0.1:6543/e_…?sslmode=disable" -v ON_ERROR_STOP=1 -1 -f supabase/migrations/20261017000000_init.sql   # one migration file
pg_dump "postgresql://…@127.0.0.1:6543/e_…?sslmode=disable" --schema=public > public.sql
DATABASE_URL="postgresql://…@127.0.0.1:6543/e_…?sslmode=disable" npx prisma migrate deploy
supabase db push --db-url "postgresql://…@127.0.0.1:6543/e_…?sslmode=disable"   # every file in supabase/migrations
supabase gen types typescript --db-url "postgresql://…@127.0.0.1:6543/e_…?sslmode=disable" > database.types.ts

What the developer login can do

It works like a Supabase project's postgres user, inside this environment's database only:

These rights are given when access is turned on; for an environment whose access was already on, turn it off and on once.

Vault secrets are encrypted with one root key that belongs to the server, not to the environment: every environment on the server uses the same key. They stay apart because each environment reaches only its own database. Keep that in mind for backups: a copy of one environment's vault.secrets can be read in any environment of the same server, and on another server only with this server's key.

It is not a superuser, cannot create roles or databases, and cannot reach another environment's database. It holds at most 10 connections.

How it is kept safe

CI turns access on for an environment on a clean machine with every change, runs a Supabase-style migration through the listener, and checks the refusals, a password reset and turning it off (evidence). A separate check signs in as one environment's login and tries every reserved schema name, renames, refused extensions, the Realtime publication, the guard itself, Vault and the other environment's database (evidence).

Limits

Edit on GitHub