Heroku's “pg:psql” command doesn't work. How to pass commands to load schema from structure.sql?

78 views
Skip to first unread message

Wins Lin

unread,
Jun 19, 2013, 5:26:20 AM6/19/13
to rubyonra...@googlegroups.com
I want to load schema from structure.sql file to Heroku's database. On
my localhost machine I do as follows and all works just fine, all tables
are created:

> C:\> psql -U postgres -a -d MyApp_development -f C:\MyApp\db\structure.sql

But when I want to perform the same task on Heroku, it suddenly says !
App not found, although I provide all correct commands and data.

First of all, I get my credentials:
> C:\Heroku\MyApp>heroku pg:credentials DATABASE

Then I do copy/paste credentials and run the command but get App not
found:
> C:\Heroku\MyApp>heroku pg:psql DATABASE -U vmh... -a -d dc... -f
> "C:\MyApp\db\structure.sql"
> ! App not found

--
Posted via http://www.ruby-forum.com/.

Wins Lin

unread,
Jun 19, 2013, 5:27:43 AM6/19/13
to rubyonra...@googlegroups.com
But the app exists. When I run just heroku pg:psql I easily get
connected to my db:
> C:\Heroku\MyApp>heroku pg:psql DATABASE
> psql (9.2.4)
> SSL-connection (key: DMN-...-...-..., bit: 256)
> Enter "help" for information.
> dc..=>

Why it says the app isn't found? I provided all correct data. What else
do I need to pass to create tables on Heroku from structure.sql?

Jordon Bedwell

unread,
Jun 19, 2013, 6:42:43 AM6/19/13
to rubyonra...@googlegroups.com
On Wed, Jun 19, 2013 at 4:27 AM, Wins Lin <li...@ruby-forum.com> wrote:
> Why it says the app isn't found? I provided all correct data. What else
> do I need to pass to create tables on Heroku from structure.sql?

This is not Heroku support... Use https://groups.google.com/forum/#!forum/heroku

Wins Lin

unread,
Jun 19, 2013, 7:26:32 AM6/19/13
to rubyonra...@googlegroups.com
Jordon Bedwell wrote in post #1112859:
> On Wed, Jun 19, 2013 at 4:27 AM, Wins Lin <li...@ruby-forum.com> wrote:
>> Why it says the app isn't found? I provided all correct data. What else
>> do I need to pass to create tables on Heroku from structure.sql?
>
> This is not Heroku support...

Yes, this isn't. But my questions is not only about Heroku. It is about
Rails deployment primarily. May Rails deployment questions be posted
here? I think yes.

Peter Hickman

unread,
Jun 19, 2013, 9:24:40 AM6/19/13
to rubyonra...@googlegroups.com
Your question is not a general deployment question. It is heavily dependent on Heroku and as such somewhere more focused would be a better place to ask.

As proof look at all the replies you have received!
That is because people see "oh he's having a problem with Heroku" (its even in the subject line) and then skip it because they know nothing about Heroku.

Hemant Gupta

unread,
Oct 13, 2014, 3:27:19 AM10/13/14
to rubyonra...@googlegroups.com
Ithink It should worked...

cd your-rails-project
heroku pg:psql -a your-app-name <db/structure.sql

Michał Muskała

unread,
Oct 13, 2014, 3:41:34 PM10/13/14
to rubyonra...@googlegroups.com
Have you tried simply using rake load task? This should do the trick.

heroku run rake db:structure:load
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b8b6cc8953538e12e22961e9abc79316%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages