2017 © Pedro Peláez
 

library migration

a migration Module like yii for zf2

image

ycheukf/migration

a migration Module like yii for zf2

  • Sunday, February 14, 2016
  • by ycheukf
  • Repository
  • 1 Watchers
  • 2 Stars
  • 181 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

migration

Introduction

YcheukfMigration is a db migration module for zend framework 2. It just like YII. Project originally based on ZfSimpleMigrations, and support multiple db migration. Only run at command line., (*1)

Features / Goals

  • db migration like YII, ROR. (finished)
  • mult db migration support. (finished)

Requirements

Installation

Install via git, (*2)

Clone this repo git clone https://github.com/ycheukf/migration.git, (*3)

Install via Composer, (*4)

Add this to your composer.json under "require": "ycheukf/migration": "dev-master", (*5)

Run command: php composer.phar update, (*6)

Usage

1: add module 'YcheukfMigration' to your application.config.php, (*7)

return array(
    'modules' => array(
        'YcheukfMigration',
        'Application',
    ),
);

2: get the helpinfo by running "php public/index.php", (*8)

Example

1: generate a new migration-file in path/migrations/default, (*9)

    php public/index.php migration generate

2: apply a migration (upgrade or downgrade) ., (*10)

    php public/index.php migration up db;
//  or
    php public/index.php migration down db;

"db" is the key of the db-config array, usually written at path/config/autoload/global.php, (*11)


return array( 'db' => array(//that is it 'driver' => 'Pdo', 'dsn' => 'mysql:dbname=myzf2;host=localhost', 'username' => 'root', 'password' => 'root', 'driver_options' => array( \PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'' ), ), // ... );

3: apply migration for all the db-array which is returned by an event "setDbConfigsFromEvent", (*12)

    php public/index.php migration up --dbsfromevent
//  or
    php public/index.php migration down --dbsfromevent

4: apply migration for a key "db" of the db-array which is returned by an event "setDbConfigsFromEvent", (*13)

    php public/index.php migration up db --dbsfromevent
//  or
    php public/index.php migration down db --dbsfromevent

The Versions

14/02 2016

dev-master

9999999-dev https://github.com/ycheukf/migration

a migration Module like yii for zf2

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.3

 

zf2 migration db ycheukf