I have created a dump from a CloudSQL database for local development. I can successfully run the dump file to restore the database on a computer running OSX but when trying on a colleagues computer running Windows, the execution fails part way with the following error:
ERROR 1822 (HY000) at line 479: Failed to add the foreign key constraint. Missing index for constraint 'fk_name' in the referenced table 'table_name'
The fk in reference points to the composite primary key of the table so I'm not sure how there could be a missing index?
Here is the failing code from the dump file:
KEY fk_name (user_id, org_id),
CONSTRAINT fk_name FOREIGN KEY (user_id, org_id) REFERENCES table_name (user_id, org_id)
The OSX computer is using MySQL Ver 14.14 Distrib 5.7.19. The windows computer is using MySQL Ver 8.0.15 (MySQL Community Server - GPL)