2017 © Pedro Peláez
 

yii2-extension yii2-power-migration

Migration Extension for Yii2.

image

rmrevin/yii2-power-migration

Migration Extension for Yii2.

  • Monday, May 18, 2015
  • by rmrevin
  • Repository
  • 2 Watchers
  • 5 Stars
  • 150 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Migration Extension for Yii2

Features

  • Full rolled back if migration is unsuccessful (for example, in mysql with the rollback is not rolled back the new or dropped tables https://dev.mysql.com/doc/refman/5.0/en/cannot-roll-back.html)

Installation

In composer.json:, (*1)

{
    "require": {
        "rmrevin/yii2-power-migration": "~1.1"
    }
}

Configuration

/config/console.php, (*2)

<?
return [
    // ...
    'controllerMap' => [
        // ...
        'migrate' => [
            'class' => yii\console\controllers\MigrateController::class,
            'templateFile' => '@vendor/rmrevin/yii2-power-migration/template.php',
        ],
    ],
    // ...
];

Usage

<?

use yii\db\Schema;
use rmrevin\yii\db\migration;

class m140317_055355_file extends migration\PowerMigration
{

    public function instructions()
    {
        return [
            'createTableFile',
            'createTableFileLink',
        ];
    }

    public function createTableFile_up()
    {
        $this->createTable('{{%file}}', [
            'id' => Schema::TYPE_PK,
            'mime' => Schema::TYPE_STRING . ' NOT NULL',
            'size' => Schema::TYPE_BIGINT . ' NOT NULL DEFAULT 0',
            'name' => Schema::TYPE_STRING . ' NOT NULL',
            'origin_name' => Schema::TYPE_STRING . ' NOT NULL',
            'sha1' => Schema::TYPE_STRING . '(40) NOT NULL',
            'image_bad' => Schema::TYPE_BOOLEAN . ' NOT NULL DEFAULT 0',
        ]);
    }

    public function createTableFile_down()
    {
        $this->dropTable('{{%file}}');
    }

    public function createTableFileLink_up()
    {
        $this->createTable('{{%file_link}}', [
            'file_id' => Schema::TYPE_PK,
            'url' => Schema::TYPE_STRING . ' NOT NULL',
        ]);
    }

    public function createTableFileLink_down()
    {
        $this->dropTable('{{%file_link}}');
    }
}

The Versions

18/05 2015

dev-master

9999999-dev

Migration Extension for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

yii2 migration migrate

18/05 2015

1.1.2

1.1.2.0

Migration Extension for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

yii2 migration migrate

18/05 2015

1.1.1

1.1.1.0

Migration Extension for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

yii2 migration migrate

18/05 2015

1.1.0

1.1.0.0

Migration Extension for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

yii2 migration migrate

18/05 2015

1.0.1

1.0.1.0

Migration Extension for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

yii2 migration migrate

18/05 2015

1.0.0

1.0.0.0

Migration Extension for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

yii2 migration migrate