Skip to content
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

Support .pgpass files for migra #207

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

waterkip
Copy link

This eases the whole connection URI setup for developers who make use of the
.pgpass file.

Signed-off-by: Wesley Schwengle wesley@opndev.io

@waterkip
Copy link
Author

waterkip commented May 28, 2022

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.

@waterkip waterkip force-pushed the pgpass-support branch 2 times, most recently from de72174 to d3e5134 Compare May 28, 2022 19:11
This eases the whole connection URI setup for developers who make use of the
.pgpass file.

Signed-off-by: Wesley Schwengle <wesley@opndev.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant