Dropping the foreign key doesn’t work.
Once dropped, running a bin/console doctrine:schema:update --force
tries to recreate the foreign key, but the query results in an error:
An exception occurred while executing ‘ALTER TABLE *_oauth2_accesstokens ADD CONSTRAINT FK_E6019FAD19EB6921 FOREIGN KEY (client_id) REFERENCES *_oauth2_clients (id) ON DELETE CASCADE’:
SQLSTATE[HY000]: General error: 3780 Referencing column ‘client_id’ and referenced column ‘id’ in foreign key constraint ‘FK_E6019FAD19EB6921’ are incompatible.
So, the real issue is with the relation between Mautic\ApiBundle\Entity\oAuth2\AccessToken::$client
and Mautic\ApiBundle\Entity\oAuth2\$id
.
Currently, in my database, oauth_accesstokens::client_id
is ´UNSIGNEDwhile
oauth2_clients::idis not, but I don't know if
UNSIGNED` can cause the error.
I’m investigating further…