2017 © Pedro Peláez
 

yii2-extension yii2-migrate

Yii2 migration assistant

image

kubo0/yii2-migrate

Yii2 migration assistant

  • Thursday, November 30, 2017
  • by KUbo0
  • Repository
  • 1 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

yii2-migrate

Migration assistant, (*1)

Installation

Console app configuration:, (*2)

return [
...
    'controllerMap' => [
        'migrate' => [
            'class' => 'kubo0\migrate\controllers\MigrateController',
            'templateFile' => 'kubo0\migrate\views\MigrationAsArray.php',
        ],
    ],
...
];

Features

Generate migration schema for existing table

yii migrate/get-schema from kubo0\migrate\controllers\MigrateController generate migration schema for all db tables if not specified., (*3)

Bidirectional migration over array schema

When you create a new table, the original way is comfy, but if you have to deal with the development of an existing table migration, the original one can confuse., (*4)

Commands avaible over array

yii migrate/create generate template from kubo0\migrate\views\MigrationAsArray.php, (*5)

  • createTable, renameTable - yes
  • dropTable, truncateTable - no
  • addColumn, dropColumn - yes
  • renameColumn, alterColumn - yes
  • addPrimaryKey, dropPrimaryKey - yes
  • addForeignKey, dropForeignKey - no
  • createIndex, dropIndex - yes
  • addCommentOnColumn, addCommentOnTable - no
  • dropCommentFromColumn, dropCommentFromTable - no
  • execute, insert, batchInsert, update, delete - not planning

Usage

Modify array to your purpose. Don't use same keys as names in same array. If you need to rename one table and on it's place create other with same name use 'tableName' insted of key;, (*6)

and ./yii migrate/up or down will apply and rollback migration., (*7)

tips used from https://yii2-cookbook.readthedocs.org/using-custom-migration-template/, (*8)

Sqlite and comments

If your migration contains comments just add kubo0\migrate\traits\MigrationSqliteCommentTrait in it, (*9)

The Versions

30/11 2017

dev-master

9999999-dev

Yii2 migration assistant

  Sources   Download

MIT

The Requires

 

by Avatar RUben

yii2 sqlite yii migrate yii2-migrate