1

I am planning on a Magento Workflow for staging and live enviroment.

I want to use git for the filesystem. The workflow here is sorted already.

But how to manage Database modifications?

While on the live server there is new customer data I have new configuration & product data in the staging system. Is there any tool to resolve these conflicts?

I researched myself https://www.mysql.de/products/workbench/ is there a way to do it with this tool? Has anybody experience with that?

2 Answers 2

1

For configuration managed by the developer I strongly recommend update scripts. Create a module Projectname_Config with a setup resource and put your configuration scripts in app/code/local/Projectname/Config/data

It is important to use data update scripts because they are triggered after the sql update scripts. So when you update a system with an outdated database, first all extensions are installed (tables created etc.) and then configured.

The naming scheme for data update scripts is

  • data-install-x.x.x.php to install version x.x.x
  • data-upgrade-x.x.x-y.y.y.php to upgrade version x.x.x to version y.y.y

Example update script

/** @var Mage_Catalog_Model_Resource_Setup $installer */
$installer = $this;
$germanStoreId = Mage::app()->getStore('de')->getId();

$installer->setConfigData('general/store_information/name', 'My cool shop');
$installer->setConfigData('general/store_information/name', 'Mein knorke Laden', 'stores', $germanStoreId);

Complex data

Theroretically you can create any data in these scripts, but I usually only use them for simple models like CMS pages and blocks, sometimes for categories.

I don't think, products should be created on a staging system and then moved over. If you must do so, I would try ImportExport to export the new products on staging to CSV and import them on production.

But the usual approach is to manage your products outside of Magento anyway, then you can import them into each instance.

For other complex products like shopping cart rules it is so complicated and error-prone that I rather take the time to create them manually on each system.

You will find a few tools that promise migrating any data from one store to another but I don't think there is a silver bullet to this problem.

0

There is a tool called https://mageflow.com/. They claim that they're able to keep track of nearly all Magento entities, but I personally haven't tried it yet.

Another way to do this is to have a module with install scripts. This module could be in your git repo, and you could increase the version number and add a new install script every time you want to push database changes to the live system. This can be a major PITA; but is the best "manual" method I know of.

1
  • That seems to be a solution. I am still leaving the questions unanswered in hope for more advices. Commented Jul 21, 2015 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.