I am using Postgresql and apartment gem and my database has many views and functions. so I am using
config.use_schemas = true
config.use_sql = true
to use pg_dump but when I run migrations it tries to use normal user account through which I am logged in to my computer rather than the one I provided in my database.yml
Is there any way to provide correct credentials so that pg_dump command can run when I run migrations? Any help would be greatly appreciated.
Are you executing
pg_dump manually from the command line? I've noticed that when it's run without the user option, it defaults to the current operating system username. Wondering if that is what's happening.
no I am not running it manually - All I am doing is creating new tenant it gives me
pg_dump: [archiver (db)] connection to database "db_name" failed: FATAL: role "computer logged in username" does not exist
somehow it still uses operating system username to run pg_dump - Is there anything else I am missing.
Thanks for your time and support.
It sounds like you may not be passing in the right database username. You should put in the username that you use to login to the database. It will be the same username in your
config/database.yml file. For example, mine is
-U chris in the command.
Yes you are right - but not sure where should I put my correct username - Does it have any config file where I can put my credentials which then will be used by apartment gem when I create new tenant through active record.
Thanks Chris - seems like they have included in their latest build (but no documentation yest) - I am gonna try and let you know how it goes..
Join 29,763+ developers who get early access to new screencasts, articles, guides, updates, and more.