Skip to content

Skipped migrations do not play well with doctrine:migrations:up-to-date #1179

@goetas

Description

@goetas

When there is one or more skipped migrations, doctrine:migrations:up-to-date will always return a non-zero exit code.

We are using doctrine:migrations:up-to-date to understand if there are migrations left to execute while deploying new code to production (only after all migrations are executed we run the deploy process).
As soon as there is at lest one skipped migration, the doctrine:migrations:up-to-date command becomes useless...

Skipping a migration has multiple reasons (that should not block a deployment):

  • the customer did not subscribe for a particular feature (thus their db does not have some structures)
  • the migration should be executed only on some envs...
  • more...

This is tricky and the only solution I have in mind is to insert in the migrations table also the skipped migrations, and later the doctrine:migrations:up-to-date --allow-skipped-migrations command will consider skipped migrations as "done" (and return a zero exit code) (--allow-skipped-migrations is a new parameter to maintain BC)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions