Reputation: 6867
In my dev env I have postgres running in a container, running db:migrate worked fine until recently I needed to change the schema to sql
config.active_record.schema_format = :sql
Not when I run db:migrate I get the following error:
pg_dump: [archiver (db)] connection to database "mydatabase" failed: FATAL: password authentication failed for user "myuser"
Looks to me that pg_dump ignores the database.yml settings. Anyone else had any luck with this kind of setup?
Upvotes: 2
Views: 706
Reputation: 6867
What I ended up doing is install postgresql-client-common and postgresql-client, in ubuntu you use:
sudo apt install postgresql-client-common postgresql-client
This gave me pg_dump locally, then I've opened a terminal in the docker machine and add host all all 0.0.0.0/0 trust
to the default pg_hba.conf file
To open a shell use:
docker exec -i -t <idOfContainer> /bin/bash
To add the line:
cd /var/lib/postgresql/data
echo host all all 0.0.0.0/0 trust >> pg_hba.conf
The last step is that you will need to add your local user to postgress, pg_dump will not use the credential from datbaase.yml so you should connect to psql and run:
CREATE USER <youruser>
Upvotes: 2