public function compareForeignKeys($caseInsensitive = false)
    {
        $fkDifferences = 0;
        $fromTableFks = $this->getFromTable()->getForeignKeys();
        $toTableFks = $this->getToTable()->getForeignKeys();

        foreach ($fromTableFks as $fromTableFkPos => $fromTableFk) {
            foreach ($toTableFks as $toTableFkPos => $toTableFk) {
                if (PropelForeignKeyComparator::computeDiff($fromTableFk, $toTableFk, $caseInsensitive) === false) {
                    unset($fromTableFks[$fromTableFkPos]);
                    unset($toTableFks[$toTableFkPos]);
                } else {
                    $test = $caseInsensitive ?
                        strtolower($fromTableFk->getName()) == strtolower($toTableFk->getName()) :
                        $fromTableFk->getName() == $toTableFk->getName();
                    if ($test) {
                        // same name, but different columns
                        $this->tableDiff->addModifiedFk($fromTableFk->getName(), $fromTableFk, $toTableFk);
                        unset($fromTableFks[$fromTableFkPos]);
                        unset($toTableFks[$toTableFkPos]);
                        $fkDifferences++;
                    }
                }
            }
        }

        foreach ($fromTableFks as $fromTableFkPos => $fromTableFk) {
            if (!$fromTableFk->isSkipSql() && !in_array($fromTableFk, $toTableFks)) {
                $this->tableDiff->addRemovedFk($fromTableFk->getName(), $fromTableFk);
                $fkDifferences++;
            }
        }

        foreach ($toTableFks as $toTableFkPos => $toTableFk) {
            if (!$toTableFk->isSkipSql() && !in_array($toTableFk, $fromTableFks)) {
                $this->tableDiff->addAddedFk($toTableFk->getName(), $toTableFk);
                $fkDifferences++;
            }
        }

        return $fkDifferences;
    }