Skip to content

smoke/ZfSimpleMigrations

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZfSimpleMigrations

Simple Migrations for Zend Framework 2. Project originally based on ZendDbMigrations but module author did not response for issues and pull-requests so fork became independent project.

Installation

Using composer

php composer.phar require vgarvardt/zf-simple-migrations:dev-master
php composer.phar update

add ZfSimpleMigrations to the modules array in application.config.php

Usage

Available commands

  • migration version - show last applied migration
  • migration list [--all] - list available migrations (all includes applied migrations)
  • migration apply [<version>] [--force] [--down] [--fake] - apply or rollback migration
  • migration generate - generate migration skeleton class

Migration classes are stored in /path/to/project/migrations/ dir by default.

Generic migration class has name Version<YmdHis> and implement ZfSimpleMigrations\Library\MigrationInterface.

Migration class example

<?php

namespace ZfSimpleMigrations\Migrations;

use ZfSimpleMigrations\Library\AbstractMigration;
use Zend\Db\Metadata\MetadataInterface;

class Version20130403165433 extends AbstractMigration
{
    public static $description = "Migration description";

    public function up(MetadataInterface $schema)
    {
        //$this->addSql(/*Sql instruction*/);
    }

    public function down(MetadataInterface $schema)
    {
        //$this->addSql(/*Sql instruction*/);
    }
}

About

Simple Migrations for Zend Framework 2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published