fabian/doctrine-migrations-liquibase

从 Doctrine 实体生成 Liquibase ChangeLog

v2.4.0 2024-01-24 12:47 UTC

This package is auto-updated.

Last update: 2024-08-24 14:22:21 UTC


README

从 Doctrine 实体生成 Liquibase ChangeLog。

Latest Stable Version License PHP Version Require Continuous Integration

API 使用

/** @var Doctrine\ORM\EntityManager $em */
$em = ...; // Retrieve Doctrine EntityManager as usual in your environment.

// Create a Liquibase SchemaTool with EntityManager
$schemaTool = new LiquibaseSchemaTool($this->em);

// Create a changelog that can be used on an empty database to build from scratch.
/** @var \DOMDocument $changeLog */
$changeLog = $schemaTool->changeLog()->getResult();
echo $changeLog->saveXML();

// Or create a diff changelog that can be used on current database to upgrade it.
/** @var \DOMDocument $diffChangeLog */
$diffChangeLog = $schemaTool->diffChangeLog()->getResult();
echo $diffChangeLog->saveXML();