Migrate your data along side your data structure.

Fund package maintenance!

Installs: 3 011

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 2

Forks: 1

Open Issues: 0


1.4.3 2019-11-23 12:56 UTC

This package is auto-updated.

Last update: 2020-10-23 15:09:13 UTC


License: MIT Build Status

This bundle is the missing piece of the Doctrine2 Migrations bundle into Symfony applications. Data migrations help you version the changes in your data, and apply them in a predictable way on every server running the application.


$ composer require gheb/data-migrations-bundle

The library can be found at vendor/gheb/DataMigrationsBundle. Finally, be sure to enable the bundle in AppKernel.php by including the following:

// app/AppKernel.php
public function registerBundles()
    $bundles = array(
        new Gheb\DataMigrationsBundle\DataMigrationsBundle(),


You can configure the path, namespace, table_name, name, organize_migrations and custom_template in your config.yml. The examples below are the default values.

# app/config/config.yml
    dir_name: "%kernel.root_dir%/DataMigrations"
    namespace: "Application\\Migrations"
    table_name: "data_migration_versions"
    name: Application Data Migrations
    organize_migrations: false # Possible values are: "BY_YEAR", "BY_YEAR_AND_MONTH", false
    custom_template: ~ # Path to your custom migrations template



If your application is based on Symfony 3, replace `php app/console` by `php bin/console` before executing any of the console commands included
in this article.

All of the migrations functionality is contained in a few console commands:

 gheb:data-migrations:execute             [execute] Execute a single migration version up or down manually.
 gheb:data-migrations:generate            [generate] Generate a blank migration class.
 gheb:data-migrations:latest              [latest] Outputs the latest version number
 gheb:data-migrations:migrate             [migrate] Execute a migration to a specified version or the latest available version.
 gheb:data-migrations:status              [status] View the status of a set of migrations.
 gheb:data-migrations:version             [version] Manually add and delete migration versions from the version table.


This bundle is based on the doctrine migrations bundle. If you need more information, please refer to the original bundle documentation.

Running tests & cs checks

$ ./vendor/bin/phpunit --bootstrap vendor/autoload.php --testdox tests $ ./vendor/bin/php-cs-fixer fix --config .php_cs.dist --verbose --dry-run src