-
-
Notifications
You must be signed in to change notification settings - Fork 371
./run psql
: connect to specified database
#66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Hi,
I didn't test this locally but if |
Yes, it produces docker compose exec postgres psql -d -U postgres It results in
I can modify the script to specify |
I updated the script to include |
That is what I thought would happen since it tries to pass |
I'd have to also test this but I think Docker Compose now supports the same type of nested variable interpolation with a default so we can also do the same in the Do you want to test that? |
…ES_DB is not specified
Did the change and seems to work based on testing 👍 |
./run psql
command now connects to database that has been set in.env
. By default the postgres image usesPOSTGRES_USER
as db name ifPOSTGRES_DB
is not specified and likewisepsql -U [user_name]
connects to database[user_name]
if database has not been specified with-d
flag.This fixes the issue where username and database name differ.
Note that if
POSTGRES_DB
is commented out / does not exist in.env
, then the script works the old way (psql -U [user_name]
).