Hello everyone,

I have recently put my production site live on remote server and encouraging users to register and I'm envisaging that the authenticated user will then be able to create content.

My conundrum is this: If I'm working on my local site updating core or adding modules etc and adding content while there is activity on my live production site so that the databases on local and  prod site are therefore different. Is there a away using the config and/or git to merge the two databases so I do not have a conflict and have to choose over one database or another, so loosing important data from either prod or local site?

Cheers

Rob

Most helpful answers

Rob - You are describing a very common situation that many of us have to deal with all the time and there are different strategies for dealing with it. 

There isn't any easy way to merge databases between environments. In general, the trick is to try and be clear in your mind about what is in the database (content) and what is stored in config files (configuration). All of the configuration changes that you make on your site that are stored in configuration files can be moved from your dev site to production site. But, changes to the database are not easily move from dev to production, so my strategy is to try to make those change directly on production and then copy the production database to my dev site. 

  • Code and configuration move from dev to prod
  • Content moves from prod to dev

Sometimes, if I'm experimenting with content on dev, I just resign myself to the fact that I'll have to copy and paste it into the production site when I'm done. In the Drupal world, there are modules like Node Export that make it possible to export specific nodes from one site to another. It's not clear to me if this Backdrop version is working - you could test it. 

https://github.com/backdrop-contrib/node_export

I think this module will help you export menus from one site to another. Menus are in that grey area between config and content. The menu itself is config, but the menu items are content. 

https://backdropcms.org/project/menu_import

But, if you understand how configuration works you can create content types, fields, and views in your local environment and move them to production via config management. You just have to understand the difference between content and config. 

Here is a good place to start.
https://docs.backdropcms.org/documentation/working-with-configuration

Comments

You should be able to make config changes and push those to the live site via CMI, but it's the "adding content locally" bit that could cause issues if you end up with partial data in two different databases, I think.

Rob - You are describing a very common situation that many of us have to deal with all the time and there are different strategies for dealing with it. 

There isn't any easy way to merge databases between environments. In general, the trick is to try and be clear in your mind about what is in the database (content) and what is stored in config files (configuration). All of the configuration changes that you make on your site that are stored in configuration files can be moved from your dev site to production site. But, changes to the database are not easily move from dev to production, so my strategy is to try to make those change directly on production and then copy the production database to my dev site. 

  • Code and configuration move from dev to prod
  • Content moves from prod to dev

Sometimes, if I'm experimenting with content on dev, I just resign myself to the fact that I'll have to copy and paste it into the production site when I'm done. In the Drupal world, there are modules like Node Export that make it possible to export specific nodes from one site to another. It's not clear to me if this Backdrop version is working - you could test it. 

https://github.com/backdrop-contrib/node_export

I think this module will help you export menus from one site to another. Menus are in that grey area between config and content. The menu itself is config, but the menu items are content. 

https://backdropcms.org/project/menu_import

But, if you understand how configuration works you can create content types, fields, and views in your local environment and move them to production via config management. You just have to understand the difference between content and config. 

Here is a good place to start.
https://docs.backdropcms.org/documentation/working-with-configuration

themetman's picture

This is a really useful reply to an interesting question.

Thank You!

Yes, Thanks a million @stpaultim that's most helpful. I'll give it a go over the weekend.

By the way, the  node_export module does not show up in the 'Install new modules', Should it? I will install it manually and test it and let you know how I get on.

Thanks again,

Cheers

Rob

https://github.com/backdrop-contrib/node_export/issues/1

Other folks have been asking about it. Please, comment on Github if you get a chance to test it - and confirm that it works or doesn't. 

If you test it and find problems, please open tickets in the issue queue. Sometimes error reports motivate module maintainers to resume work modules. 

https://github.com/backdrop-contrib/node_export/issues/1

Other folks have been asking about it. Please, comment on Github if you get a chance to test it - and confirm that it works or doesn't. 

If you test it and find problems, please open tickets in the issue queue. Sometimes error reports motivate module maintainers to resume work modules.