CiviCRM Cannot add or update a child row: a foreign key constraint fails error after upgrading from 4.7.30 to 5.0.2
A workaround to this is to comment out the SQL lines in the file that drop, modify and rebuild the FK.  /CRM/Upgrade/Incremental/sql/4.6.18.mysql.tlp

This will have to be done for every upgrade with a db that does not include the FK.