cli
cli copied to clipboard
Misleading docstring: supabase db
Improve documentation
Link
Describe the problem
The subcommand description says "Manage Local Postgres Databases". But if you scroll further you would see that these commands are not only applicable to the local databases.
Describe the improvement
The easiest fix would be to change it to "Manage Postgres Databases".
More comprehensive fix should be the following:
- Introduce a way to alias environments (remotes). E.g.
supabase db remote add myselfhostedenv --db-url postgres://user:password@localhost:5432/postgres,supabase db remote add mylocalmanagedenv --local,supabase db remote add myhostedenv --project-id myapp - Replace db-url with remote aliases. I.e.:
supabase db reset myselfhostedenv,supabase db diff mylocalmanagedenv,supabase db dump myhostedenv - Introduce a default remote (this could be the locally managed one if no remotes were added)
- Write new documentation for lint,diff,dump,reset,push with examples for a new workflow (e.g. capture diff from hostedenv in a new migration, apply newly created migration to localenv, commit the migration as being applied on hostedenv)
Additional context
I see that these subcommands are inspired by git. So probably there should be .supabase/config with "[remotes]" section rather than .env and .toml files.
Also, you don't want your internet-available database password to be stored in plaintext, so some solution should be proposed to mitigate that risk. E.g. VPN, SSH, or some secret management like HashiCorp Vault, or as simple as caching the encrypted password in a session, similar to how ssh-agent does it.