feat(Console): Add --check option to diff command#1535
feat(Console): Add --check option to diff command#1535ahmed-bhs wants to merge 1 commit intodoctrine:3.9.xfrom
Conversation
This option allows checking for schema differences in a CI/CD environment without generating a file. It exits with a non-zero status code if changes are detected, providing a clear signal for CI workflows and actionable feedback for developers.
7dddfc6 to
5b3e769
Compare
In what situations is this needed? I mean, if there are migrations, you probably want to run them at some point, and you probably want to do so inside your CI, right? |
|
@ahmed-bhs is your intent to check if "pending migrations exists"?
Why not using the https://github.com/doctrine/migrations/blob/3.9.x/src/Tools/Console/Command/UpToDateCommand.php command?
|
|
If the goal is to detect cases where you forgot to generate your migration after changing your mapping, this is already covered by the Thre is no reason to reimplement the same command in doctrine/migrations. |
Summary
This pull request introduces a new
--checkoption to thedoctrine:migrations:diffcommand to improve its usability in CI/CD environments.Currently, verifying that no pending migrations exist requires using fragile and complex shell scripts that check for the creation of new migration files. This approach is not ideal as it's not explicit and can be brittle. This PR proposes a cleaner, integrated solution.
The new
--checkflag allows you to verify the database schema status without generating a migration file.This makes CI configuration much simpler, more readable, and improves the overall developer experience by providing a robust, self-documenting way to ensure schema consistency in automated workflows.