Provide schema update for changed primary key

Junyor - April 12, 2008 - 21:23
Project:Path Redirect
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

The Drupal 5.x version of Path Redirect uses path as the primary key and rid as a unique key. Drupal 6.x, however does the opposite and there doesn't seem to be any update that makes this change.

#1

HorsePunchKid - April 14, 2008 - 02:30
Status:active» patch (code needs review)

Good catch. Here are patches for 5.x and 6.x. I tested in both MySQL and Postgres the upgrades from 5.x-1.1 to 5.x-1.x-dev and from 5.x-1.1 to 6.x-1.x-dev, so I'm fairly confident that they're working well.

AttachmentSize
path_redirect-6.x-1.x_keys_1.patch638 bytes
path_redirect-5.x-1.x_keys_1.patch1.63 KB

#2

HorsePunchKid - April 14, 2008 - 03:38
Title:Schema difference between Drupal 5.x and Drupal 6.x versions» Provide schema update for changed primary key
Status:patch (code needs review)» fixed

Committed. Titled changed because this actually applies to 5.x independent of 6.x. Patch for 5.x above didn't include an updated hook_install, but I fixed that and committed it. Thanks again for spotting the problem!

#3

Junyor - April 17, 2008 - 00:40
Version:6.x-1.x-dev» 5.x-1.x-dev
Status:fixed» active

I'm not sure the committed fix will work for existing users. For instance, what if a user upgrades to 6.x without first upgrading to the latest 5.x? And what if the user has already run update #4?

#4

HorsePunchKid - April 20, 2008 - 00:11

If a user upgrades from any 5.x release (i.e. non-dev-version) to 6.x, the 6.x installer has the same update functions that the 5.x branch has, only rewritten for the 6.x API. If a user has already run update 4 because they were running a dev version, they presumably know how to deal with that:

UPDATE {system} SET schema_version = 3 WHERE name = 'path_redirect'

Then run update.php, and you'll get the necessary updates. As far as I understand, upgrading from dev versions is not something that needs to be explicitly supported. That said, since we've had this dev version sitting around for quite some time, it might make sense to add another update function; I'm just not (yet) convinced it's necessary.

I have some more patches to port to 6.x before releasing it, anyway, and I'll make sure to test the upgrade paths before I do.

#5

Junyor - April 22, 2008 - 15:06
Status:active» fixed

Got it. I'll run the update manually.

#6

Anonymous (not verified) - May 6, 2008 - 15:12
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.