[development] Trouble with upgrade paths from different branches
Fredrik Sandve Kilander
fredrik.kilander at gmail.com
Sat Feb 19 12:58:08 UTC 2011
Hello. I am having trouble with hook_update_N(). My module (yr_verdata) has two branches for D6, and I want to provide an upgrade path from both of these to D7. However, I can't seem to get the correct schema version when upgrading. In my install file i have the following:
function yr_verdata_update_7000(&$sandbox) {
// Check to see what schema we are updating from.
// If we are going from 6.x-2.x to 7.x-1.x, the schema is already ready for
// 7.x-1.x so we just update the schema version number.
$version = drupal_get_installed_schema_version('yr_verdata', TRUE);
if ($version > 6199) { // Updating from 6.x-2.x, no problem.
drupal_set_installed_schema_version('yr_verdata', 7000);
}
else { // Updating from 6.x-1.x, modify the database table.
// Some update logic.
}
return t('Some friendly message');
}
The problem here is that drupal_get_installed_schema_version() simply returns 6999, no matter what. What am I doing wrong?
I could just remove the update logic that messes with the database table from the 7.x branch doing it all in 6.x-2.x, and require 6.x-1.x users to upgrade to 6.x-2.x before going to 7.x-1.x - but that sounds like a bad idea to me, and just extra work for people who want to upgrade to D7 with this module.
Any help is appreciated!
More information about the development
mailing list