Jump to content

Upgrade to 6.2.4 DB Didn't upgrade


Recommended Posts

I deleted the product_width, product_height, product_depth and dimension_unit fields from my database a few versions ago because I don't use them.  When I upgraded to the next version it automatically readded them, so I deleted them again.  I know, I know I should have left them alone and will once this is figured out.  Anyway, upgraded to 6.2.4 and these fields were not automatically added and I don't have the tax_percent field either.  I went ahead and added the product_width, product_height, product_depth and dimension_unit fields  I also get the orange error in admin/database.  CubeCart_order_summary.custom_oid has a key type KEY but expecting UNIQUE KEY.

I have fields in the inventory table that I have added and what have been added via plugins.

I don't think my database was updated when I upgraded to 6.2.4.  In the 6.2.4 detup/db/upgrade file it says to CHANGE `dimension_unit` `dimension_unit` VARCHAR(2) NULL DEFAULT 'cm';.  I don't know how to do that.

I'd like to be sure my database is upgraded to the the current version 6.2.4. Anyway for me to check?  When I upgraded I did get the red banner telling me to upgrade my database, which I did.

Thanks for any and all help.

Link to comment
Share on other sites

We would like to know the versions involved in your upgrade path.

The dimension fields were added in CC620, so if you upgraded to CC620, then restored the code back to a previous version, the database still had those columns.

You may have removed them while at a version earlier than CC620. Then upgraded again and they were added as the upgrade sequence went past CC620.

CubeCart does not check for a database schema being complete for any given version. There are only two checks:
* CubeCart_history has the "version" logged as the upgrade sequence goes through the various files in /setup/db/upgrade/. In admin, Maintenance, Upgrade tab will list the records in this table
* The codebase has an array of what indices should be in the schema, and enumerating the tables will flag any discrepancies

But what third-party columns are present and what stock columns are missing is not analyzed.

The CHANGE you mention is a file named /setup/db/upgrade/6.2.3.sql, which would have been executed if the upgrade sequence went from a version of CubeCart prior to CC623.

Link to comment
Share on other sites

I do have the 'live_from' column.  I have tried to getthe "dimension_unit' column to say Yes 'cm' but it won't take I guess.  I put the following in admin/Query MySQL Database

ALTER TABLE `CubeCart_inventory` CHANGE `dimension_unit` `dimension_unit` VARCHAR(2) NULL DEFAULT 'cm'; #EOQ.  This was straight from the 6.2.3 db file. 

I got the above to work.  I'll see if I get more errors

 

Now I keep getting this error:

[20-Mar-2019 09:50:24 America/Louisville] PHP Warning:  http_build_query() [<a href='http://docs.php.net/manual/en/function.http-build-query.php'>function.http-build-query.php</a>]: Parameter 1 expected to be Array or Object.  Incorrect value given in /home/claudias/public_html/classes/db/database.class.php on line 522

 

ADMIN ERROR LOG:

File: [database.class.php] Line: [556] "ALTER TABLE `CubeCart_inventory` CHANGE `dimension_unit` `dimension_unit` VARCHAR(2) NULL DEFAULT 'cm' " - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''cm'' at line 1


Also, what about that orange banner error.  I seems I got that awhile back in another version.

Thanks for all your help.

Link to comment
Share on other sites

The http_build_query is a known issue: See:
https://github.com/cubecart/v6/issues/2259

This statement from the upgrade SQL file 6.2.3.sql was supposed to have added a UNIQUE index. Oddly, 6.2.1.sql initially added an INDEX, then dropped it, then re-added it back.

Please just use phpMyAdmin (or similar) to make sure CubeCart_order_summary has for the column 'custom_oid' only one index and that it is a UNIQUE index. Also verify that 'custom_oid' is permitted to have NULL.

Link to comment
Share on other sites

When I try to change the index to Unique I get this error, I don't have a column custom_oid_2

Error

SQL query:

ALTER TABLE `CubeCart_order_summary` ADD UNIQUE(`custom_oid`)

MySQL said: Documentation

#1062 - Duplicate entry '' for key 'custom_oid_2'

 

1301191130_Captureindexes.PNG.f13d7fb0fca86fc52d95027deae80aea.PNG

 

476379311_Capturecustomoid.thumb.PNG.9b7cd3ff5fb6ba0747daa7722193993f.PNG

Link to comment
Share on other sites

I believe you can just click the edit icon for custom_oid and change the BTREE to UNIQUE. (Edit: I mentioned the wrong selector -- look for what is currently INDEX, change to UNIQUE.)

Then, determine if you have a column in this table named custom_oid_2 and delete it. You say there isn't one, but look again.

Link to comment
Share on other sites

" I believe you can just click the edit icon for custom_oid and change the BTREE to UNIQUE. "  It will only let me change BTREE to HASH under advanced options/ Index type.   When I try to change the INDEX choice to Unique is when I get the error.  For the life of me I cannot find a custom_oid_2

Link to comment
Share on other sites

Regarding the details for the column 'custom_oid', verify that it has permission to hold the value null. If this column does not have this permission (that is, the details indicate NOT NULL), then edit that column so that it can hold a null. Also, set that column to have a DEFAULT NULL.

Once the column has permission to hold a null, then the values in that column for all the records must be changed to null.

UPDATE CubeCart_order_summary SET `custom_oid` = NULL

(Assuming you aren't using any sort of custom order id.)

Then that column can have a UNIQUE index. As it is now, an empty string, being in more than one record, is triggering the Duplicate Entry warning message. A null does not count for being duplicative.

Link to comment
Share on other sites

In phpMyAdmin, you wouldn't need a query. There is a dialog window that lets you configure it all.

But, after deleting any indexes relating to the 'custom_oid' column, and also deleting the actual column 'custom_oid', both deletions from CubeCart_order_summary (assuming you are not actually using it to hold custom order id expression), the queries to put it back is:

ALTER TABLE `CubeCart_order_summary` ADD `custom_oid` VARCHAR(50) NULL DEFAULT NULL;
ALTER TABLE `CubeCart_order_summary` ADD UNIQUE(`custom_oid`);

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...