/** * Returns the computed difference between two table objects. * * @param Table $fromTable * @param Table $toTable * @param boolean $caseInsensitive * @return TableDiff|Boolean */ public static function computeDiff(Table $fromTable, Table $toTable, $caseInsensitive = false) { $tc = new self(); $tc->setFromTable(clone $fromTable); $tc->setToTable(clone $toTable); if ($toTable->getDatabase() || $fromTable->getDatabase()) { $platform = $toTable->getDatabase()->getPlatform() ?: $fromTable->getDatabase()->getPlatform(); if ($platform) { $platform->normalizeTable($tc->getFromTable()); $platform->normalizeTable($tc->getToTable()); } } $differences = 0; $differences += $tc->compareColumns($caseInsensitive); $differences += $tc->comparePrimaryKeys($caseInsensitive); $differences += $tc->compareIndices($caseInsensitive); $differences += $tc->compareForeignKeys($caseInsensitive); return $differences > 0 ? $tc->getTableDiff() : false; }