cli icon indicating copy to clipboard operation
cli copied to clipboard

Misleading docstring: supabase db

Open Vanuan opened this issue 2 years ago • 0 comments

Improve documentation

Link

$ supabase db

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:

  1. 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
  2. Replace db-url with remote aliases. I.e.: supabase db reset myselfhostedenv, supabase db diff mylocalmanagedenv, supabase db dump myhostedenv
  3. Introduce a default remote (this could be the locally managed one if no remotes were added)
  4. 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.

Vanuan avatar Apr 28 '23 17:04 Vanuan