When I execute ./concrete/bin/concrete5 c5:update && ./concrete/bin/concrete5 c5:package-update --all && ./concrete/bin/concrete5 c5:entities:refresh, that appears to be working as expected. I then follow that with ./concrete/bin/concrete5 c5:database:charset:set utf8mb4, but that does not work as it keeps throwing the same errors that the Foreign Key can’t be updated:
converting table “atExpressSettings”: An exception occurred while executing ‘ALTER TABLE atExpressSettings CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci’:
SQLSTATE[HY000]: General error: 1832 Cannot change column ‘exEntityID’: used in a foreign key constraint ‘FK_E8F67F0FCE2D7284’
I have been working on this issue for days now and I’m unable to get passed it to move the side up in the versioning scheme.
Do you have a lot of custom express entities set up in this site? Just wondering if something might’ve gotten deleted without cleaning itself up. Sometimes that can happen with a user getting deleted, so maybe if there’s an Express entity associated with a user? But those are just wild guesses.
My workround was (assuming you don’t have any data in the express tables) was to delete the tables, the recreate them from a fresh install of a later core version. There are some forum posts on that subject quite a way back.
The following SQL query should help establish if your tables have differing collations set:
-- replace `<database name>` with the actual name of
-- your database
SET @database_name := '<database name>';
SELECT
TABLE_COLLATION,
count(*) AS n
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = @database_name
GROUP BY TABLE_COLLATION;
You should get a result like this if they are all the same:
+--------------------+-----+
| TABLE_COLLATION | n |
+--------------------+-----+
| utf8mb4_unicode_ci | 427 |
+--------------------+-----+
1 row in set (0.088 sec)
If they are not the same, you can convert the tables that are in the minority with something like the following (after backing up your database in case anything goes wrong):
-- replace `<table_name>` with the name of
-- the actual table you want to convert
ALTER TABLE <table_name>
CONVERT TO CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;
I’ve updated the tutorial with the above information.