kreait/ezpublish-migrations-bundle

Migrations for eZ Publish 5

Installs: 547

Dependents: 0

Stars: 12

Watchers: 4

Forks: 4

Open Issues: 1

Language: PHP

2.0.2 2015-08-03 15:04 UTC

README

Latest Stable Version License Build Status Code Coverage Scrutinizer Code Quality Gitter

Migrations for eZ Publish 5, based on Doctrine Migrations, very similar to Symfony's DoctrineMigrationsBundle.

Installation

composer require kreait/ezpublish-migrations-bundle

Configuration

Enable the bundle in EzPublishKernel.php by including the following:

// ezpublish/EzPublishKernel.php
public function registerBundles()
{
    $bundles = array(
        //...
        new Kreait\EzPublish\MigrationsBundle\KreaitEzPublishMigrationsBundle(),
    );
}

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

// ezpublish/config/config.yml
ezpublish_migrations:
    dir_name: "%kernel.root_dir%/EzPublishMigrations"
    namespace: Application\Migrations
    table_name: ezmigration_versions
    name: Application Migrations
    ez_user: admin

Usage

All of the migrations functionality is contained in the following commands:

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

The usage is identical to Symfony's DoctrineMigrationBundle, except for the missing :diff command. Please have a look at the official documentation for further information.

Changing the current migration user during a migration

You can change the current eZ Publish user inside a migration by issuing the following command:

$this->changeMigrationUser('another_username');

and restore the default Migration user by using:

$this->restoreDefaultMigrationUser();

Usage examples

See src/Resources/doc/examples for some usage examples.

Acknowledgments