Bill Riley
Bill Riley

Reputation: 97

How to rake database to Heroku on cloud9

I'm a noobie to Heroku, Github and RoR, so this week I'm stumbling through it.

I have a DB on Git and I'd like to clone it and push it to my Heroku App via Cloud9 (I'm working on a chromebook)

I can't use the commands in the C9 terminal:

    heroku run rake db:migrate
    heroku restart

tl;dr: How do I migrate a git DB to a Heroku app's Database from Cloud9?

oh, and also: If I'm using the wrong terminology, just let me know how bad of a person I am and correct me.

Upvotes: 0

Views: 1765

Answers (4)

ZombieBsAs
ZombieBsAs

Reputation: 171

If my previous answer doesn't work for you, because you can't install the Heroku Toolbelt in C9. You could run rake to perform the migrate in your production (Heroku) environment like this:

RAILS_ENV=production rake db:migrate

This will use the database.yml from your local repository (in C9) to update the Heroku (production) DB.

I do not recommended this practice because you could have another DB definitions in the Heroku repository from previous commits/pushes, but solves the problem.

Upvotes: 0

ZombieBsAs
ZombieBsAs

Reputation: 171

You have to install the Heroku toolbelt via c9pm (Cloud9 Package Manager):

c9pm install heroku

Then you have to login into your Heroku account and perform the db:migrate. Also I suggest to run it detached with this line:

heroku run:detached rake db:migrate

I couldn't perform a normal rake from C9. I always have to run it detached to make it work.

Upvotes: 1

John Beynon
John Beynon

Reputation: 37507

Whilst Cloud9 supports git deployments you can't run the commands that you need to via their console to manage your application. You will need to use the heroku gem locally to manage your application which isn't going to be possible on a Chrome book. Your best option will be use use a VPS server somewhere that you can SSH into (assuming that's possible) to work via.

Upvotes: 1

j_mcnally
j_mcnally

Reputation: 6968

Heroku has an api. You may need to make calls against it if you cant install the heroku ruby gem. Maybe someone has done this try google.

Upvotes: 0

Related Questions