magento资源中的版本和data_version有什么区别


What is the difference between version and data_version in magento resources?

mysql> select * from core_resource;
+-------------------------+------------+--------------+
| code                    | version    | data_version |
+-------------------------+------------+--------------+
| adminnotification_setup | 1.0.0      | 1.0.0        |

从未看到这两列之间的值存在差异,我不确定data_version的确切用途。

这是有用的吗? 我能从中受益吗?

data_version和相应的所谓"数据升级脚本"出现在CE1.4中。

数据安装/升级脚本在形式和功能上与"常规"安装和升级脚本相同。它们只是在初始化期间稍后执行,主要的环境区别是有一个存储对象和一个初始化的请求对象,尽管我无法想象后者在升级工作流中的适当使用。

Mage_Core_Model_App

public function run($params)
{
    //snip...
    if ($this->_cache->processRequest()) { //cache hook
        $this->getResponse()->sendResponse();
    } else {
        $this->_initModules(); //triggers "normal" install & upgrade workflow
        //snip...
        if ($this->_config->isLocalConfigLoaded()) {
            //snip...
            $this->_initCurrentStore($scopeCode, $scopeType);
            $this->_initRequest();
            Mage_Core_Model_Resource_Setup::applyAllDataUpdates(); //data upgrade scripts
        }
        $this->getFrontController()->dispatch();
    }
    return $this;
}