google_appliance_update_1 should be renamed to google_appliance_update_6201, see http://api.drupal.org/api/function/hook_update_N/6.

Comments

larskleiner’s picture

StatusFileSize
new605 bytes

Patch rolled against 6.x-2.x-dev.

larskleiner’s picture

Status: Active » Needs review
jweowu’s picture

Status: Needs review » Reviewed & tested by the community

Tested Drupal 5 with google_appliance upgraded to Drupal 6.

update.php picked out the 6201 update:

The following queries were executed
google_appliance module
Update #6201

* variable_set(google_appliance_debug)
* variable_del(google_debug)
* variable_set(google_appliance_default_client)
* variable_del(google_appliance_client)
* variable_set(google_appliance_default_collection)
* variable_del(google_appliance_collection)
* ALTER TABLE {cache_google} ADD INDEX cid (cid)
* ALTER TABLE {cache_google} RENAME TO {cache_google_appliance}

jweowu’s picture

StatusFileSize
new620 bytes

We should incorporate coltrane's patch from http://drupal.org/node/385162

Otherwise the Drupal 5 update is broken.

That patch no longer applies, so I've rolled it into a new version of this one.

I've tested it on a Drupal 5 upgrade:

The following queries were executed
google_appliance module
Update #6000

* ALTER TABLE {cache_google} ADD `serialized` SMALLINT NOT NULL DEFAULT 0

Update #6201

* variable_set(google_appliance_debug)
* variable_del(google_debug)
* variable_set(google_appliance_default_client)
* variable_del(google_appliance_client)
* variable_set(google_appliance_default_collection)
* variable_del(google_appliance_collection)
* ALTER TABLE {cache_google} ADD INDEX cid (cid)
* ALTER TABLE {cache_google} RENAME TO {cache_google_appliance}

larskleiner’s picture

Thanks for testing, I commited my patch from above.

I'm not sure why you want to add the serialized column in an update, it's already part of the new cache_google_appliance schema. Wouldn't this be good enough to not break the D5 upgrade?

jweowu’s picture

No, the schema function is only ever used when installing the module for the very first time. When upgrading the module (whether between 6.x releases, or upgrading from 5.x) that schema function isn't touched, because the module already exists in the system table.

The update hooks therefore need to make the necessary changes to make the existing tables match the latest schema, in any update situation.

People who started with 6.x-2.x will have this column, but users upgrading from Drupal 5 will not. The 60xx updates are explicitly for upgrading from a previous major version of Drupal, so update 6000 is ignored for users who started out with the original 6.x-2.x-dev (only update 6201 will be executed in their case).

edit: d'oh. I originally said the 6x00 updates were for updating from an earlier drupal, when I meant to say the 60xx updates.

larskleiner’s picture

Status: Reviewed & tested by the community » Closed (fixed)

I see your point, thanks. I committed a revised patch so that it doesn't conflict with my patch from above.