SQL errors updating the 6.x dev

Posts: 541
Joined: 08/13/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Internationalizationizer

Hi,

I just updated my D6 installation to test the latest dev version of UC in drupal.org and I get these errors.

<?php
   
* user warning: Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE uc_payment_receipts DROP PRIMARY KEY in drupal6includesdatabase.mysql-common.inc on line 386.
   
* user warning: Can't DROP 'order_id'; check that column/key exists query: ALTER TABLE uc_payment_receipts DROP INDEX order_id in \drupal6\includes\database.mysql-common.inc on line 448.
    * user warning: Multiple primary key defined query: ALTER TABLE uc_payment_receipts CHANGE receipt_id `receipt_id` INT unsigned NOT NULL auto_increment, ADD PRIMARY KEY (receipt_id) in \drupal6\includes\database.mysql-common.inc on line 520.
    * user warning: Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE uc_payment_check DROP PRIMARY KEY in \drupal6\includes\database.mysql-common.inc on line 386.
    * user warning: Can'
t DROP 'order_id'; check that column/key exists query: ALTER TABLE uc_payment_check DROP INDEX order_id in drupal6includesdatabase.mysql-common.inc on line 448.
   
* user warning: Multiple primary key defined query: ALTER TABLE uc_payment_check CHANGE check_id `check_id` INT unsigned NOT NULL auto_increment, ADD PRIMARY KEY (check_id) in drupal6includesdatabase.mysql-common.inc on line 520.
   
* user warning: Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE uc_flatrate_methods DROP PRIMARY KEY in drupal6includesdatabase.mysql-common.inc on line 386.
   
* user warning: Multiple primary key defined query: ALTER TABLE uc_flatrate_methods CHANGE mid `mid` INT unsigned NOT NULL auto_increment, ADD PRIMARY KEY (mid) in drupal6includesdatabase.mysql-common.inc on line 520.
   
* user warning: Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE uc_shipments DROP PRIMARY KEY in drupal6includesdatabase.mysql-common.inc on line 386.
   
* user warning: Multiple primary key defined query: ALTER TABLE uc_shipments CHANGE sid `sid` INT unsigned NOT NULL auto_increment, ADD PRIMARY KEY (sid) in drupal6includesdatabase.mysql-common.inc on line 520.
   
* user warning: Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE uc_packages DROP PRIMARY KEY in drupal6includesdatabase.mysql-common.inc on line 386.
   
* user warning: Multiple primary key defined query: ALTER TABLE uc_packages CHANGE package_id `package_id` INT unsigned NOT NULL auto_increment, ADD PRIMARY KEY (package_id) in drupal6includesdatabase.mysql-common.inc on line 520.
   
* user warning: Can't DROP 'PRIMARY'; check that column/key exists query: ALTER TABLE uc_product_adjustments DROP PRIMARY KEY in \drupal6\includes\database.mysql-common.inc on line 386.
    * user warning: Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE uc_orders DROP PRIMARY KEY in \drupal6\includes\database.mysql-common.inc on line 386.
    * user warning: Can'
t DROP 'uid'; check that column/key exists query: ALTER TABLE uc_orders DROP INDEX uid in drupal6includesdatabase.mysql-common.inc on line 448.
   
* user warning: Multiple primary key defined query: ALTER TABLE uc_orders CHANGE order_id `order_id` INT unsigned NOT NULL auto_increment, ADD PRIMARY KEY (order_id) in drupal6includesdatabase.mysql-common.inc on line 520.
   
* user warning: Can't DROP 'order_id'; check that column/key exists query: ALTER TABLE uc_order_admin_comments DROP INDEX order_id in \drupal6\includes\database.mysql-common.inc on line 448.
    * user warning: Can'
t DROP 'order_id'; check that column/key exists query: ALTER TABLE uc_order_comments DROP INDEX order_id in drupal6includesdatabase.mysql-common.inc on line 448.
   
* user warning: Can't DROP 'order_id'; check that column/key exists query: ALTER TABLE uc_order_line_items DROP INDEX order_id in \drupal6\includes\database.mysql-common.inc on line 448.
    * user warning: Can'
t DROP 'order_id'; check that column/key exists query: ALTER TABLE uc_order_log DROP INDEX order_id in drupal6includesdatabase.mysql-common.inc on line 448.
   
* user warning: Can't DROP 'order_id'; check that column/key exists query: ALTER TABLE uc_order_products DROP INDEX order_id in \drupal6\includes\database.mysql-common.inc on line 448.
    * user warning: Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE uc_product_features DROP PRIMARY KEY in \drupal6\includes\database.mysql-common.inc on line 386.
    * user warning: Can'
t DROP 'nid'; check that column/key exists query: ALTER TABLE uc_product_features DROP INDEX nid in drupal6includesdatabase.mysql-common.inc on line 448.
   
* user warning: Multiple primary key defined query: ALTER TABLE uc_product_features CHANGE pfid `pfid` INT unsigned NOT NULL auto_increment, ADD PRIMARY KEY (pfid) in drupal6includesdatabase.mysql-common.inc on line 520.
   
* user warning: Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE uc_countries DROP PRIMARY KEY in drupal6includesdatabase.mysql-common.inc on line 386.
   
* user warning: Multiple primary key defined query: ALTER TABLE uc_countries CHANGE country_id `country_id` INT unsigned NOT NULL auto_increment, ADD PRIMARY KEY (country_id) in drupal6includesdatabase.mysql-common.inc on line 520.
   
* user warning: Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE uc_zones DROP PRIMARY KEY in drupal6includesdatabase.mysql-common.inc on line 386.
   
* user warning: Can't DROP 'zone_country_id'; check that column/key exists query: ALTER TABLE uc_zones DROP INDEX zone_country_id in \drupal6\includes\database.mysql-common.inc on line 448.
    * user warning: Multiple primary key defined query: ALTER TABLE uc_zones CHANGE zone_id `zone_id` INT unsigned NOT NULL auto_increment, ADD PRIMARY KEY (zone_id) in \drupal6\includes\database.mysql-common.inc on line 520.
    * user warning: Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE uc_taxes DROP PRIMARY KEY in \drupal6\includes\database.mysql-common.inc on line 386.
    * user warning: Multiple primary key defined query: ALTER TABLE uc_taxes CHANGE id `id` INT unsigned NOT NULL auto_increment, ADD PRIMARY KEY (id) in \drupal6\includes\database.mysql-common.inc on line 520.
?>

Posts: 541
Joined: 08/13/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Internationalizationizer

After some testings, It seems you cannot remove a primary key if you do not add a new one just after, in the same request.

I tested with phpmyadmin, removing the primary key bring the same error, but adding a new one in the same request works, see the example :

<?php
ALTER TABLE
{uc_payment_receipts} DROP PRIMARY KEY, ADD PRIMARY KEY(`receipt_id`)
?>

Posts: 2267
Joined: 08/07/2007
AdministratoreLiTe!

These updates were for the sites still on Drupal 5 to get to the schema definition already defined in Ubercart 2.0.

Sadly, I had forgotten to take into account all of the people who had already installed the D6 version, so all of these errors showed up. However, I don't think they actually affect anything. Yes, it's a messy update, but I'm not sure what I can do about it. New users won't see them, and I'm hoping that upgraded sites won't have these problems. I've asked for more people to test that process.