Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top