2

I have a custom module with several install and upgrade scripts under the sql directory, that create and alter my sql table.

When Magento runs the scripts it updates both version and data_version fields in core_resource table.

Now I need to add a data script to add data to the table. If I create a data-install-0.1.0.php under my data directory, it wouldn't run since version in DB is already 0.1.3.

The only way I could make it work is naming my data script data-upgrade-0.1.3-0.1.4.php and changing version in config.xml to 0.1.4. Of course this sets also version (resource version) to 0.1.4.

If in the future I want to create an sql upgrade script will it have to be upgrade-0.1.3-0.1.5.php or upgrade-0.1.4-0.1.5.php?

Is this the correct way to do it? Is there any way to change only version or only data_version?

1 Answer 1

0

You next upgrade or data upgrade script will need to be upgrade-0.1.4-0.1.5.php

Both columns will be updated in the database so you are required to create old.version-new.version

2
  • Is this the only way to do it? Seems weird to manage two version variables if they always get updated together... Dec 21, 2017 at 9:31
  • I'm afraid so. The data version and module version both get set to what is in the modules config.xml
    – DanCarlyon
    Dec 21, 2017 at 9:42

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.