if you have something like
ALTER TABLE `accounts_purchases` ADD CONSTRAINT `accounts_purchases_account` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, ADD CONSTRAINT `accounts_purchases_item` FOREIGN KEY (`item_id`) REFERENCES `items` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
and you are about to update those constraints:
You have to drop them first, by getting all their “symbols”…
here is a “simple” regexp to modify SQL export to DROPs
$result = preg_replace( '/ADD CONSTRAINT (.*?) FOREIGN KEY \(.*([,;])/m', 'DROP FOREIGN KEY \1\2', $subject);