Magento CE 1.8.1.0 – Install-Upgrade Script vs Data-Upgrade Script

ce-1.8.1.0data-scriptupgrade-script

I'm upgrading a module to version lets say 0.1.3. Say I have these files:

data/mymodule_setup/data-upgrade-0.1.2-0.1.3.php
sql/mymodule_setup/upgrade-0.1.2-0.1.3.php

Will the sql upgrade script run first? The data upgrade script requires a column that will be added in the other script, so if it's not there yet it will fail.

Best Answer

The order is

  1. install
  2. install upgrade script
  3. data script
  4. data upgrade script

More info can be found here: http://inchoo.net/magento/magento-install-install-upgrade-data-and-data-upgrade-scripts/

or http://www.sitepoint.com/magento-install-upgrade-data-scripts-explained/

Or thanks to @RickBuczynski the following link: http://vinaikopp.com/2014/11/03/magento-setup-scripts/

Addition: If you have modules that depend on each other, you should know that when several modules are installed/updated at once, first all normal upgrade scripts run, then all data upgrade scripts. Each in the order how the module are loaded, i.e. with regards to dependencies.

Related Topic