I have the same error on upgrade 3.3.1 → 4.0.2. I believe this installation was upgaded from earlier v2 releases through the web interface. Has a fix been found?
My investigation so far:
- Under mysql:
SHOW ENGINE INNODB STATUS;
…
LATEST FOREIGN KEY ERROR
2021-11-17 08:40:00 0x7f8f30e67700 Error in foreign key constraint of table mautic
.ma_oauth2_clients
:
FOREIGN KEY (role_id) REFERENCES ma_roles (id):
…
This is the ‘last’ error so maybe more problems exist?
After the upgrade I see:
DESC desc mautic.ma_oauth2_clients;
±--------------------±-----------------±-----±----±--------±---------------+
| Field | Type | Null | Key | Default | Extra |
±--------------------±-----------------±-----±----±--------±---------------+
…
| role_id | int(10) unsigned | YES | | NULL | |
±--------------------±-----------------±-----±----±--------±---------------+
DESC mautic.ma_roles;
±---------------------±-------------±-----±----±--------±---------------+
| Field | Type | Null | Key | Default | Extra |
±---------------------±-------------±-----±----±--------±---------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
…
I also have an oauth2_clients table without the ‘ma_’ that I believe was created at 3.3.1 but never used due to an incorrect prefix on clean install and restore of data at that release. This uses int(10) unsigned for the ids. Another difference is that these unused tables are utf8mb4 while the used tables are plain utf8.
Should I apply a fix to one column of one table manually or would it be worth trying something as described in Was unable to update to 4.0, here's what finally worked for me ?