Error upgrading to 2.x

sirkitree - September 14, 2009 - 16:39
Project:Flag
Version:6.x-2.x-dev
Component:Flag core
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

update_6004 is giving me errors.

* user warning: Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE flags DROP PRIMARY KEY in /Users/jbitner/Sites/drupal/includes/database.mysql-common.inc on line 386.
* user warning: Multiple primary key defined query: ALTER TABLE flags CHANGE fid `fid` SMALLINT unsigned NOT NULL auto_increment, ADD PRIMARY KEY (fid) in /Users/jbitner/Sites/drupal/includes/database.mysql-common.inc on line 520.

#1

quicksketch - September 14, 2009 - 18:42
Status:active» fixed

Thanks sirkitree, I'm glad you caught this since this is actually a change that's been in the 1.x branch for months and I was about to release 1.2 with this bug in it. The problem seems like you can't convert a serial column to a serial column using the recommended method in MySQL (see http://api.lullabot.com/db_change_field). So unfortunately we need to introduce a database type check to prevent this bug from cropping up.

However the error doesn't cause any database damage, since it's actually just a fix for users that upgraded from the Drupal 5 version of Flag.

AttachmentSize
flag_update_6004_fix.patch 1.28 KB

#2

quicksketch - September 14, 2009 - 19:09

Hmm, I realized while this prevents the error on Drupal 6 sites, it now doesn't upgrade Drupal 5 sites correctly. Rather than trying to fix this problem retroactively (I haven't gotten any bug reports about this problem at all surprisingly), I've just moved the entire update to flag_update_6000(), so it will fix new sites upgrading from Drupal 5 to Drupal 6 Flag. Note that the Drupal 5 Views Bookmark to Flag conversion did not have this problem at all, so I'm guessing the number of users migrating from D5 Flag to D6 Flag must be fairly minimal.

AttachmentSize
flag_update_6004_fix.patch 1.63 KB

#3

sirkitree - September 14, 2009 - 19:22

Looks good to me, but I haven't tested the d5 to d6 upgrade. Thanks!

#4

System Message - September 28, 2009 - 19:30
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.