I updated my local development server from 8.3.2 to 8.5.14 without any problem. Unfortunately when I upgraded one of my production websites the upgrade ran into Foreign Key Errors with Express and Oauth.
Here is the problem that I discovered. During the upgrade most of the tables were successfull converted to utf8mb4 character sets with utf8mb4_unicode_ci collations. Unfortunately, in some of the express tables there are columns that are hard coded with utf8 character sets when the tables were originally created. For example:
CREATE TABLE ExpressEntityAssociations
(
id
char(36) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT ‘(DC2Type:guid)’,
source_entity_id
char(36) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT ‘(DC2Type:guid)’,
target_entity_id
char(36) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT ‘(DC2Type:guid)’,
…
The upgrade tries to add a foreign key constraint to (‘id’) in a table where id is create with a utf8mb4 character set referencing a second table where (‘id’) was created with the utf8 character set (i.e. see example above) This causes the Foreign Key error.
I know that everyone has said the way around this is to export the entire database, edit the resulting SQL file to carefully change the character set references to utf8mb4 and then import the editted file. I got around the problem by dropping all the foreign key constraints for the Express and Oauth tables, modifying the table columns with the character set hardcoded to utf8 to utf8mb4 in MariaDB and then used the alter table commands from the export file to recreate the foreign keys for the Express and Oauth tables. Seemed to work fine. I preferred this option since I have a very large database and did not want to run into problems on the import of a massive file.
Question – I still have one more production server to update and I am trying to minimize downtime. Does anyone see a problem with modifying the express and Oauth tables prior to the upgrade – i.e. dropping the foreign keys, changing the charater sets on the applicable rows and then recreating the foreign keys for the express and oauth tables before running the upgrade. Will there be any problems if the Express and Oauth tables are setup with utf8mb4 character and utf8mb4_unicode_ci collations in versions of concrete below 8.5?
Sorry, but I am not a SQL maven so I don’t understand all the implications of changing the character sets of specific tables on Concrete versions below 8.5
Thanks in advance for any help with this problem.