Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\DriverManager;
$connFrom = DriverManager::getConnection([
'url' => "mysql://root:root@127.0.0.1/test1",
], new Configuration);
$connTo = DriverManager::getConnection([
'url' => "mysql://root:root@127.0.0.1/test2",
], new Configuration);
$diff = Comparator::compareSchemas(
$connFrom->getSchemaManager()->createSchema(),
$connTo->getSchemaManager()->createSchema(),
);
echo implode(";\n", $diff->toSql($connTo->getDatabasePlatform()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.