migra
migra copied to clipboard
Support .pgpass files for migra
This eases the whole connection URI setup for developers who make use of the .pgpass file.
Signed-off-by: Wesley Schwengle [email protected]
Hi, I didn't wrote a test for it because I'm too dumb I guess to get a working developer environment. So I did tests with my own setup which work.
Test prerequisites:
- A .pgpass file:
localhost:5432:*:yourdbuser:yourdbpassword
- Have two databases, eg foo and bar
How to test:
- invoke migra as usual, but without your username and password, in this case I assume your local user equals the postgres username:
migra \
postgresql://localhost/foo \
postgresql://localhost/bar \
--unsafe --ignore-extension-versions
-
This should yield a connection
-
invoke migra as usual, but a with username but without a password:
migra \
postgresql://yourdbuser@localhost/foo \
postgresql://yourdbuser@localhost/bar \
--unsafe --ignore-extension-versions
-
This should yield a connection
-
invoke migra as usual, but a with username but without a password and make sure you have a DB named the same as your user::
migra \
postgresql://yourdbuser@localhost/ \
postgresql://yourdbuser@localhost/bar \
--unsafe --ignore-extension-versions
- This should yield a connection
When you remove the .pgpass file you should not get a connection and migra fails as it did in the past.