I just updated from Location 6.x-3.0-test3 to 6.x-3.0-rc1.

When I ran update.php (following all appropriate steps, maintenance mode etc) I get the following warnings:

Drupal database update 
user warning: Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER 
TABLE location DROP PRIMARY KEY in /usr/local/webapp/spdev.dlcdev.com/includes/database.mysql-common.inc on line 
386. 
user warning: Multiple primary key defined query: ALTER TABLE location CHANGE lid `lid` INT unsigned NOT NULL 
auto_increment, ADD PRIMARY KEY (lid) in /usr/local/webapp/spdev.dlcdev.com/includes/database.mysql-common.inc on 
line 520. 
user warning: Can't DROP 'location_instance_nid_idx'; check that column/key exists query: ALTER TABLE 
location_instance DROP INDEX location_instance_nid_idx in /usr/local/webapp/spdev.dlcdev.com/includes 
/database.mysql-common.inc on line 448. 
user warning: Can't DROP 'location_instance_vid_idx'; check that column/key exists query: ALTER TABLE 
location_instance DROP INDEX location_instance_vid_idx in /usr/local/webapp/spdev.dlcdev.com/includes 
/database.mysql-common.inc on line 448. 
user warning: Can't DROP 'location_instance_uid_idx'; check that column/key exists query: ALTER TABLE 
location_instance DROP INDEX location_instance_uid_idx in /usr/local/webapp/spdev.dlcdev.com/includes 
/database.mysql-common.inc on line 448. 
user warning: Can't DROP 'location_instance_genid_idx'; check that column/key exists query: ALTER TABLE 
location_instance DROP INDEX location_instance_genid_idx in /usr/local/webapp/spdev.dlcdev.com/includes 
/database.mysql-common.inc on line 448. 
user warning: Can't DROP 'location_instance_lid_idx'; check that column/key exists query: ALTER TABLE 
location_instance DROP INDEX location_instance_lid_idx in /usr/local/webapp/spdev.dlcdev.com/includes 
/database.mysql-common.inc on line 448. 
user warning: Duplicate key name 'nid' query: ALTER TABLE location_instance ADD INDEX nid (nid) in /usr/local/webapp 
/spdev.dlcdev.com/includes/database.mysql-common.inc on line 434. 
user warning: Duplicate key name 'vid' query: ALTER TABLE location_instance ADD INDEX vid (vid) in /usr/local/webapp 
/spdev.dlcdev.com/includes/database.mysql-common.inc on line 434. 
user warning: Duplicate key name 'uid' query: ALTER TABLE location_instance ADD INDEX uid (uid) in /usr/local/webapp 
/spdev.dlcdev.com/includes/database.mysql-common.inc on line 434. 
user warning: Duplicate key name 'genid' query: ALTER TABLE location_instance ADD INDEX genid (genid) in /usr/local 
/webapp/spdev.dlcdev.com/includes/database.mysql-common.inc on line 434. 
user warning: Duplicate key name 'lid' query: ALTER TABLE location_instance ADD INDEX lid (lid) in /usr/local/webapp 
/spdev.dlcdev.com/includes/database.mysql-common.inc on line 434. 
user warning: Can't DROP 'PRIMARY'; check that column/key exists query: ALTER TABLE zipcodes DROP PRIMARY KEY in 
/usr/local/webapp/spdev.dlcdev.com/includes/database.mysql-common.inc on line 386. 

And the following Query failures (only listed ones that failed):

Failed: ALTER TABLE {location} DROP PRIMARY KEY 
Failed: ALTER TABLE {location} CHANGE lid `lid` INT unsigned NOT NULL auto_increment, ADD PRIMARY KEY (lid) 

Failed: ALTER TABLE {location_instance} DROP INDEX {location_instance}_nid_idx 
Failed: ALTER TABLE {location_instance} DROP INDEX {location_instance}_vid_idx 
Failed: ALTER TABLE {location_instance} DROP INDEX {location_instance}_uid_idx 
Failed: ALTER TABLE {location_instance} DROP INDEX {location_instance}_genid_idx 
Failed: ALTER TABLE {location_instance} DROP INDEX {location_instance}_lid_idx 

Failed: ALTER TABLE {location_instance} ADD INDEX nid (nid) 
Failed: ALTER TABLE {location_instance} ADD INDEX vid (vid) 
Failed: ALTER TABLE {location_instance} ADD INDEX uid (uid) 
Failed: ALTER TABLE {location_instance} ADD INDEX genid (genid) 
Failed: ALTER TABLE {location_instance} ADD INDEX lid (lid) 
Failed: ALTER TABLE {zipcodes} DROP PRIMARY KEY
CommentFileSizeAuthor
#12 location_install_1_31.patch8.02 KBscottrigby

Comments

bdragon’s picture

Ha, I was so busy testing the 5.x-2.7-5.x-3.0rc1 and 5.x-3.0rc1-6.x-3.0rc1 updates that I forgot about making sure the test3-rc1 updates worked. Sorry about that.

It looks to me like it still ended up in the correct place. If you want to double check, you can use schema.module (http://drupal.org/project/schema) to compare your tables with the "correct" schema.

scottrigby’s picture

heh -- thanks bdragon ;)

I'll try the schema module later - (looks good btw) - and will report back if anything seems off...

Cheers -
Scott

Anonymous’s picture

I also had this problem when updating. Do I just ignore it, or try and restore my database backup?

bdragon’s picture

Assuming it was just those indexes, you can safely ignore it, as that code was just dealing with renaming the indexes that weren't using the correct naming convention. As I mentioned already, if you want to make absolutely sure the schema matches, use schema.module. (And report any differences so I can ensure they get synced in the next update.)

scottrigby’s picture

bdragon, I installed the schema module, and see some mismatches. The mismatches under the Location fieldset are:

    *
      location
          o column is_primary:
            declared: array('type' => 'int', 'size' => 'tiny', 'not null' => TRUE, 'default' => 0)
            actual: array('type' => 'int', 'size' => 'tiny', 'not null' => FALSE, 'default' => 0, 'disp-width' => '4')
    *
      zipcodes
          o column zip:
            declared: array('type' => 'varchar', 'length' => 16, 'not null' => TRUE, 'default' => '0')
            actual: array('type' => 'varchar', 'length' => '16', 'not null' => FALSE, 'default' => '0')
          o column latitude:
            declared: array('type' => 'numeric', 'not null' => TRUE, 'default' => 0, 'precision' => 10, 'scale' => 6)
            actual: array('type' => 'numeric', 'not null' => FALSE, 'default' => 0, 'precision' => '10', 'scale' => '6')
          o column longitude:
            declared: array('type' => 'numeric', 'not null' => TRUE, 'default' => 0, 'precision' => 10, 'scale' => 6)
            actual: array('type' => 'numeric', 'not null' => FALSE, 'default' => 0, 'precision' => '10', 'scale' => '6')
          o column country:
            declared: array('type' => 'char', 'length' => 2, 'not null' => TRUE, 'default' => '')
            actual: array('type' => 'char', 'length' => '2', 'not null' => FALSE, 'default' => '')

Is this what you meant?

scottrigby’s picture

I submitted an issue to a different module queue... and just afterward I wondered if the location field might be part of the cause?

Can you take a look, and see if the error message I'm seeing could be caused by mismatched table columns above?
#318196: preg_match() expects parameter 2 to be string instead array

Thanks :)
Scott

bdragon’s picture

Nope, those mismatches are all completely harmless.

That said, I'm working on an update routine to correct them.

bdragon’s picture

Assigned: Unassigned » bdragon

OK, committed an update that sets a message to explain the warnings a bit, and add another update to fix the schema mismatches.
http://drupal.org/cvs?commit=144929

bdragon’s picture

Title: Update warnings » [master] Update warnings
bdragon’s picture

scottrigby’s picture

ok - thanks bdragon.

But... can you advise me on updating this one... I'm not sure what I should be doing now --
I followed the link in #8, to a Diff of /contributions/modules/location/location.install -- but it's not clear to me what to do (apologies for not being experienced with this).

* It looks like I can download a patch from this update. What do you recommend?
* Assuming I've got the right patch (attached), should I apply this to the already patched location module (that's what it looks like but hard for me to tell)?
* If so, do you think it would be enough to add the re-patched files, and run update.php? Or does it require more than that?

Thanks for your advice on this - hope it doesn't seem like hand-holding, I just haven't worked with Drupal's CVS before ;)

scottrigby’s picture

StatusFileSize
new8.02 KB

(patch attached)

bdragon’s picture

Or you can ask the viewvc for a checkout of the file :P

http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/location/lo...

scottrigby’s picture

Oh I see now - we can get to this by following the breadcrumb trail at the top... then there's a download link under each revision (duh!) - heh
thanks bdragon.

ok, replaced location.install with the the updated file, then ran update.php again - all seemed to go smoothly, and there are now no Location table mismatches in the schema compare window :)

The preg match bug is still there though...

yesct’s picture

Status: Active » Closed (fixed)

this looks resolved, so ill mark it closed.

yesct’s picture

Issue tags: +location Master Issues

also, tagging as a master issue. bdragon, if you want to keep all the master issues open, sorry! let me know.