Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento: How can I migrate configuration changes from development to production environment?

We are actively developing modules and when we push the changes to our production site, there are usually several configuration changes we need to make. Would be nice to automate this...thoughts?

like image 936
Nick Avatar asked Nov 17 '10 18:11

Nick


People also ask

What is the difference between staging and production?

A staging environment (stage) is a nearly exact replica of a production environment for software testing. Staging environments are made to test codes, builds, and updates to ensure quality under a production-like environment before application deployment.

What is migration in magento2?

We have developed the Magento 2 Data Migration Tool to help you efficiently move all of your products, customers, and order data, store configurations, promotions and more to Magento 2. This guide provides information on the tool and best practices for using it to migrate your data.


2 Answers

Not sure if it is still actual, but if you mean changes to system -> config, then it is much more better to use such config.xml nodes instead of writing database upgrade.

Magneto processes core_config_data table into global XML structure, so you may just change XML structure without using db table for making changes to system configuration.

Here is small example:

<config>
   <stores>
       <french>
          <design>
             <theme>
                 <default>french</default>
             <theme>
          </design>
       </french>
   </stores>
   <websites>
       <base>
          <design>
             <theme>
                 <default>english</default>
             <theme>
          </design>
       </base>
   </websites>
</config>

In this example one configuration field is changed for two scopes in Magento. It is definition of current theme depending on current website and store.

So <stores /> node contains configuration values for a particular store. Where each child element is named with store code and contains configuration data in nested view. And <website /> node contains configuration values for a particular website. Where each child element is named with website code and contains configuration data in nested view as well.

Also there is available <default /> node for configuration values in global scope. But it will be overridden by <stores /> and <websites /> if a particular value is for a scope.

I am making changes to configuration only via config.xml because deploying the project is much easier when you just need to install it via Magento installer without doing changes in "System -> Config".

like image 58
Ivan Chepurnyi Avatar answered Sep 20 '22 02:09

Ivan Chepurnyi


Make the changes as part of a an install or upgrade script in your module's "sql" directory. In your module's "config.xml" file increment the version number of every matching change and also remember to fill in the <config><global><resources><MODULE_setup><setup> node.

Because the script is run within the context of Magento you have access to all the normal functionality too, updates don't have to be in the form of SQL commands.

like image 30
clockworkgeek Avatar answered Sep 23 '22 02:09

clockworkgeek