Prune excess doctrine migrations

0.3 2023-11-22 21:19 UTC

This package is auto-updated.

Last update: 2024-04-22 22:16:52 UTC



  • Automatically prunes old migration files and their corresponding database entries just before running new Doctrine migrations.
  • Designed to work in production; migration files should be absent, leaving only the database entries to be removed.
  • Handles Doctrine migrations' multiple configurations.
  • Prevents warnings about missing migration files if you manually removed them.

Supported Platforms

  • MySQL
  • Sqlite


  • Requires Doctrine Migration Bundle.
  • Tested on Symfony 6, but should work wherever Doctrine Migrations Bundle v3.* is compatible.


To install the Doctrine Migration Pruner Bundle, you can use composer:

composer require hackzilla/doctrine-migration-pruner-bundle


Add the following to your application's config:

  remove_migrations_before: '2007-05-01'  # Can be null or a valid date-time

It's advisable to start with an earlier date-time.


Run your Doctrine migrations as you normally would:

bin/console doctrine:migrations:migrate

Note: The pruning operation will not execute if the --dry-run option has been specified.


There are currently no tests available.

However, you can use Doctrine Migration Pruner Repo to test the migration pruning.

Contributions and Issues

See all contributors on GitHub.

Please report issues using GitHub's issue tracker: GitHub Repo

If you find this project useful, consider buying me a coffee.


This bundle is released under the MIT license. See the LICENSE file for details.