small medium large xlarge

Nick_london_pragsmall
31 Oct 2016, 20:18
Nicholas Parsons (8 posts)

Greetings!

I’ve been going through the book and creating the shine app on my windows 10 machine. Everything has been working fine for the most part but I’ve come across a slight stumbling block. I installed PostgreSQL 9.6 on my machine and am using pgAdmin to check tables and perform SQL related tasks. Now I’ve come across a part in the book where the db/schema.rb file is removed and a rails db:migrate command is run to create the db/structures.sql file. When I run this command from my command prompt I am getting an error saying that pg_dump does not exist. I have set my PATH environment variable to the bin directory of my PostgreSQL installation but the problem persists. I believe it has to do with rails trying to execute “pg_dump” and not “pg_dump.exe” because when I run the latter command from the shine rails app directory it is found and asks for a password.

Is there a way to modify the canned rails script to force “pg_dump.exe” to be run instead of just “pg_dump”?

Thanks in advance for your help! –Nick

Dmfcb_pragsmall
31 Oct 2016, 20:42
David Copeland (433 posts)

Hm. I’m surprised more people don’t have this problem. I don’t have a windows box to test on, but I wonder if something like pg_dump.bat in your path that passes through to the .exe would work? My windows knowledge is very old so forgive me if that’s a silly suggestion

Nick_london_pragsmall
01 Nov 2016, 12:52
Nicholas Parsons (8 posts)

Hi Dave,

Thanks for the quick and helpful response! Once I created the .bat file with the following command in it and then re-ran the db:migrate command it worked great.

“C:\Program Files\PostgreSQL\9.6\bin\pg_dump.exe” -s -x -O -f C:\playground\shine\db\structure.sql shine_development

In between threads I also tried to modify the PostgreSQL_database_tasks.rb file in active_record/tasks directory by adding the exe suffix to “pg_dump” but that didn’t work.

This is good now and I wanted to say your book is very well written and the approach / concept you took is very interesting.

Thanks again! –Nick

Dmfcb_pragsmall
01 Nov 2016, 12:57
David Copeland (433 posts)

Thanks, glad that worked. Still surprised you had to resort to hacks tho :(

You must be logged in to comment