I've a Rails 2.1.2 App hosted on site 5.
This App is running since 2 years and I want to migrate the site on heroku.
No pb to install the site on heroku, but what about the data?!
What is the best strategy to export from site 5 (I've phpMyAdmin) and then import to heroku?
Thanks
Export the data to your local system as SQL dump from phpMyAdmin, import it into your development database and then use the built-in Heroku db tools (based on Taps) to import into production:
heroku db:push
Related
I've recently re-installed Mac OS X on my Macbook, and am just getting my development environment and projects back up and running again. For one of my Ruby on Rails apps (which is running on Heroku) I need to grab the (PostgreSQL) database from Heroku and migrate it back to my development environment. How would I go about doing this?
I fixed this by first creating my database (psql in Terminal) and then using the CREATE DATABASE db_name command. Then I used heroku pg:backups capture to capture a backup/shot of the database. I downloaded this using heroku pg:backups public-url b001 and then pg_restore --dbname=db_name --verbose /path/to/download.
Hope that hopes anyone!
So I would like to make an user to admin in the app I have on heroku. When developing my app I can do it via rails c or I just open up the database file with some SQL viewer. But how can I do it for heroku?
To run the rails console in heroku, you have to use heroku run rails console (assuming you have the heroku toolbelt installed).
See https://devcenter.heroku.com/articles/getting-started-with-rails3#console or https://devcenter.heroku.com/articles/getting-started-with-rails4#console
I have facing problems with migrating data to my heroku app which has Postgresql as database for my hosted site(Production). At my development site i have rails 3.2.13 with Sqlite3 as database. I have followed Ruby on rails Tutorial by Michael Hartl
i have used git push heroku to update my site at heroku. i also want to update database along with data. But heroku run rake db:migrate migrates schema not data. I tried db:push to push data to heroku but i get error
dependency.rb in 'to_specs' :Could not find sequel (~) 3.20.0
also i have searched and found that i should first my sqlite data to dump.sql and then run
heroku pg:psql HEROKU_POSTGRESQL_COLOR --app app_name < file.sql as answered in https://stackoverflow.com/questions/15371394/...
but it failed with
the local psql command could not be located
please tell me what i am doing wrong. or what is the right way to update heroku postgresql with my development sqlite3 data.
Thanks in Advance
It is not a good idea to fill the production database with the data that you have now in the developement database. Because, if you have problems with your production database in the future, and you need to refill it again, your development db may changed (e.g dropped), and you are not going to be able to do it again.
For this need, Rails provides seeds in db/seeds.rb file. You should create all the neccessary objects there.
Then when you push your code to Heroku, Heroku is going to prepare the database, create the schema, and seed it. If you need to seed the db manually, you can run bundle exec rake db:seed, if you want to run it in Heroku: heroku run bundle exec rake db:migrate
Is there way to dump heroku postgres database and import the data into my local SQLite database?
I tried using https://github.com/ludicast/yaml_db and heroku db:pull with no success. I am developing on Windows 7.
Please read through
https://devcenter.heroku.com/articles/heroku-postgres-import-export
and follow those to export.
Though the above link can be used to export alone, it does not have solution for the entire process. So you can look on the similar question and its solution
Copy a heroku postgres db to a local sqlite db
I have now my rails 3.2.1 app running on Heroku.
I've tried to upload the database to mongohq via the heroku mongo:push command, after installing the heroku mongo plugin.
https://github.com/pedro/heroku-mongo-sync
I get the message asking me to confirm if I want to push, but once the push is done, there is nothing my db.
I'm not sure if it is a problem with heroku or if i'm missing a step.
Could it be that i need to put my app in production mode and migrate the database to production?
I'm not sure how to do that either.
Cheers
does your local heroku connection conform to the plugins assumptions [in the readme's config section]? if not you'll have to set it via:
export MONGO_URL = mongodb://user:pass#localhost:1234/db
i'll also note, that even after doing this i had to uninstall the heroku plugin and reinstall it from this fork: http://github.com/fjg/heroku-mongo-sync.git
heroku plugins:install http://github.com/fjg/heroku-mongo-sync.git
Check out the MongoSync Ruby Gem
It's a gem I wrote for that very purpose when I had to constantly copy my Local MongoDB database to and from my Production DB for a Project (I know it's stupid). It's extremely easy to use. Once you've entered your DB details in the mongo_sync.yml file, you can push and pull DBs using these rake tasks:
$ rake mongo_sync:push # Push DB to Remote
$ rake mongo_sync:pull # Pull DB to Local
Note: It's also available as shell script for non-ruby apps: mongo-sync