Giter Club home page Giter Club logo

migrationbundle's Introduction

README

Doctrine Migrations integration bundle providing :

  • Generation of migration classes on a per bundle basis
  • Generation for multiple target platforms
  • API allowing to execute migrations programmaticaly

Build Status

Installation

Install the bundle with composer:

composer require claroline/migration-bundle

Then add the bundle to your application kernel:

// app/AppKernel.php
<?php

use Symfony\Component\HttpKernel\Kernel;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Claroline\MigrationBundle\ClarolineMigrationBundle(),
        );
    }

    // ...
}

Commands

You can generate migrations for a specific bundle using:

php app/console claroline:migration:generate AcmeFooBundle

This command will create migration classes for all the available platforms in the Migrations directory of the bundle.

You can execute a migration using one of the following commands:

php app/console claroline:migration:upgrade AcmeFooBundle
php app/console claroline:migration:downgrade AcmeFooBundle

By default, both commands execute the nearest available migration version (relatively to the current/installed one), but you can specify another target using the --target option:

php app/console claroline:migration:downgrade AcmeFooBundle --target=20130101124512
php app/console claroline:migration:upgrade AcmeFooBundle --target=nearest
php app/console claroline:migration:upgrade AcmeFooBundle --target=farthest

where farthest means a full upgrade/downgrade.

The following command displays the list of available versions for a bundle and highlights the current/installed one:

php app/console claroline:migration:version AcmeFooBundle

Finally, you can delete generated migration classes which are above the current version of a bundle using:

php app/console claroline:migration:discard AcmeFooBundle

This last command is useful if you intend to "merge" several migration classes generated during development into a single migration class. In such a case, the steps to follow would be:

# downgrading to the newest version you want to keep
php app/console claroline:migration:downgrade AcmeFooBundle --target=20130101124512
# deleting everything above that version
php app/console claroline:migration:discard AcmeFooBundle
# generating a new migration class
php app/console claroline:migration:generate AcmeFooBundle

API

The whole API is accessible through the migration manager class:

<?php

$bundle = $container->get('kernel')->getBundle('AcmeFooBundle');
$container->get('claroline.migration.manager')->upgradeBundle($bundle, '20131201134501');

migrationbundle's People

Contributors

maxailloud avatar netmisa avatar ngodfraind avatar stefk avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.