Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing database with heroku #4

Open
robinsandborg opened this issue Apr 18, 2016 · 1 comment
Open

Syncing database with heroku #4

robinsandborg opened this issue Apr 18, 2016 · 1 comment

Comments

@robinsandborg
Copy link

When following the instructions in the readme, the heroku app seems to start up with a clean database. Are there any tools to sync the database between the local and heroku environments?

@gabrielmoreira
Copy link
Owner

@robinsandborg, sorry about the delay to help you, I was on vacation.

Maybe there is some plugin to import / export, but might be incompatible with other installed plugins. I've tried some with partial success, but generally have limitations or problems. https://straightupcraft.com/craft-plugins

I can also suggest to you, a similar way I like to work:

  1. You can back up your site database craftman mysql:backup, open the .sql file within the backup and import into mysql in heroku. You need only take care to edit the .sql file and replace the localhost or 127.0.0.1 for the domain that you will use in heroku. In some cases you want to change http to https in some urls within the .sql file.
  2. Create serious content only on Heroku, and use the local environment just to test the fields and templates.
  3. When you are satisfied with the stage of local development, create the fields manually in heroku environment, or use a plugin to import fields (Sometimes i use https://straightupcraft.com/craft-plugins/field-manager).
  4. Make a backup of your Craft on heroku (settings page > download backup), and import this backup to your local database. To help in the import process remember to change the .sql file and replace the domain by 127.0.0.1, or https to http again. To import a backup on your local environment, craftman has craftman mysql:restore <BACKUP_FILE_NAME>, and along with it, there is a way for you to create a script / hook to make these replacements automatically each time you import a backup with craftman: See a function mysql_restore_hook() here https://github.com/gabrielmoreira/craftman#advanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants