2017 © Pedro Peláez
 

symfony-bundle migrations-bundle

Wrapper for DoctrineMigrationsBundle that enables container aware migrations

image

zenstruck/migrations-bundle

Wrapper for DoctrineMigrationsBundle that enables container aware migrations

  • Monday, April 15, 2013
  • by kbond
  • Repository
  • 0 Watchers
  • 0 Stars
  • 1,107 Installations
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

ZenstruckMigrationsBundle

NOTE: DoctrineMigrationsBundle now supports ContainerAware migrations, (*1)

Wrapper for DoctrineMigrationsBundle that enables container aware migrations., (*2)

NOTE: For use with Symfony 2.0 use the 1.x branch, (*3)

Installation

  1. Add to composer.json (see http://getcomposer.org/), (*4)

    "require" :  {
        "zenstruck/migrations-bundle": "*",
    }
    
  2. Register the bundle, (*5)

    <?php
    // app/AppKernel.php
    
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Zenstruck\Bundle\MigrationsBundle\ZenstruckMigrationsBundle(),
        );
        // ...
    )
    

Usage

  • To make use of container aware data migrations your migrations must extend Zenstruck\Bundle\MigrationsBundle\Migrations\AbstractMigration. (note: Migrations that extend Doctrine\DBAL\Migrations\AbstractMigration will still run normally)
  • Implement the dataUp() method and add your custom migration logic. (note: The up() method will be run before dataUp)
  • Implement the dataDown() method and add your custom migration logic. (note: The down() method will be run before dataDown)
  • Optionally implement the getDataDescription method and return a description of the migration.
  • Migrate using the zenstruck:migrations:migrate command. (note: make sure you run migrations with this command and not doctrine:migrations:migrate

Migration Template

<?php

namespace Application\Migrations;

use Zenstruck\Bundle\MigrationsBundle\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Auto-generated Migration: Please modify to your need!
 */
class Version20120419113825 extends AbstractMigration
{
    public function up(Schema $schema)
    {
        // this up() migration is autogenerated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");

    }

    public function down(Schema $schema)
    {
        // this down() migration is autogenerated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");

    }

    public function dataUp(ContainerInterface $container)
    {
        // container aware logic
    }

    public function dataDown(ContainerInterface $container)
    {
        // container aware logic
    }

    /**
     * OPTIONAL
     */
    public function getDataDescription()
    {
        return parent::getDataDescription();
    }
}

The Versions

15/04 2013

dev-master

9999999-dev http://zenstruck.com/project/ZenstruckMigrationsBundle

Wrapper for DoctrineMigrationsBundle that enables container aware migrations

  Sources   Download

MIT

The Requires

 

migrations

11/01 2013

v2.1.1

2.1.1.0 http://zenstruck.com/project/ZenstruckMigrationsBundle

Wrapper for DoctrineMigrationsBundle that enables container aware migrations

  Sources   Download

MIT

The Requires

 

migrations

11/01 2013

1.x-dev

1.9999999.9999999.9999999-dev http://zenstruck.com/project/ZenstruckMigrationsBundle

Wrapper for DoctrineMigrationsBundle that enables container aware migrations

  Sources   Download

MIT

The Requires

 

migrations

11/01 2013

v1.2.1

1.2.1.0 http://zenstruck.com/project/ZenstruckMigrationsBundle

Wrapper for DoctrineMigrationsBundle that enables container aware migrations

  Sources   Download

MIT

The Requires

 

migrations

30/11 2012

v2.1.0

2.1.0.0 http://zenstruck.com/project/ZenstruckMigrationsBundle

Wrapper for DoctrineMigrationsBundle that enables container aware migrations

  Sources   Download

MIT

The Requires

 

migrations

30/11 2012

v1.2.0

1.2.0.0 http://zenstruck.com/project/ZenstruckMigrationsBundle

Wrapper for DoctrineMigrationsBundle that enables container aware migrations

  Sources   Download

MIT

The Requires

 

migrations

22/11 2012

v2.0.0

2.0.0.0 http://zenstruck.com/project/ZenstruckMigrationsBundle

Wrapper for DoctrineMigrationsBundle that enables container aware migrations

  Sources   Download

MIT

The Requires

 

migrations

02/11 2012

v1.1.0

1.1.0.0 http://zenstruck.com/project/ZenstruckMigrationsBundle

Wrapper for DoctrineMigrationsBundle that enables container aware migrations

  Sources   Download

MIT

The Requires

 

migrations

09/08 2012

v1.0.0

1.0.0.0 http://zenstruck.com/project/ZenstruckMigrationsBundle

Wrapper for DoctrineMigrationsBundle that enables container aware migrations

  Sources   Download

MIT

The Requires

 

migrations