I have trouble understanding the new numbering scheme for contrib module updates. My problem is this: I'm developing a module where there are two versions for Drupal 5 and 6, and both have identical database schemes. Naturally, since I want to maintain both, if I gave them updates I should number them in a way that both get the same updates in the same order - and if a user of the D5 version updated to Drupal 6, then the updates wouldn't be run a second time there.

In the update numbering scheme the first digit is reserved for core compatibility. But for me, core compatibility is irrelevant, since the database scheme is independent of core version. If I followed the new scheme, I'd have to name my updates as 5100, 5101, 5102 etc. in D5 and 6100, 6101, 6102 etc. in D6. But after updating to Drupal 6, the update system would try to run all the 61XX updates, and since they match the 51XX updates this would result in errors.

So, how should I number the updates? I could of course use the same numbers in both versions, but which numbers would they be? 51XX or 61XX? Or maybe 01XX, to signify that the updates have nothing to do with Drupal core versions?

In short, I think this scenario has been overlooked in the numbering scheme change. The change assumes that there should be a module update associated with each Drupal core update, but this simply is not so. I think the hook_update_N api is still in need of clarification.

Comments

Anonymous’s picture

I think you need an extra level of version checking. Use a variable_get('mymod_db_schema_version', MYMOD_DB_SCHEMA_VERSION) and filter the update function based on the current saved value. Each update function would need to variable_set to the new schema version format.

sun’s picture

Status: Active » Closed (duplicate)