Created
April 30, 2020 06:26
-
-
Save docteurklein/deb8fd757822cd00f8432ac7a6c61d1d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Doctrine\DBAL\Schema\Comparator; | |
use Doctrine\DBAL\Connection; | |
use Doctrine\DBAL\Configuration; | |
use Doctrine\DBAL\DriverManager; | |
$connFrom = DriverManager::getConnection([ | |
'url' => "mysql://root:[email protected]/test1", | |
], new Configuration); | |
$connTo = DriverManager::getConnection([ | |
'url' => "mysql://root:[email protected]/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