tmukherjee13/yii2-reverse-migration

Generate working migration classes from existing Database

Installs: 16 718

Dependents: 0

Suggesters: 0

Security: 0

Stars: 22

Watchers: 5

Forks: 11

Open Issues: 2

Type:yii2-extension

2.4.0 2021-07-24 13:46 UTC

This package is auto-updated.

Last update: 2024-04-21 12:42:27 UTC


README

Latest Stable Version License Total Downloads Monthly Downloads Daily Downloads Scrutinizer Build Scrutinizer Code Quality

Generate working migration classes from existing Database

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist tmukherjee13/yii2-reverse-migration "*"

or add

"tmukherjee13/yii2-reverse-migration": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, Add the following in console.php:

return [
    ...
    'components' => [
        ...
    ],
    'controllerMap' => [
        'migration' => [
            'class' => 'tmukherjee13\migration\console\controllers\MigrationController',
            'templateFile' => '@tmukherjee13/migration/views/template.php',
        ],
    ],
    ...
];

then you can use the migration command as follows:

for table migration,

yii migration/table <tablename>

or

yii migration/table <tablename1>,<tablename2>

for data migration,

yii migration/data <tablename>

or

yii migration/data <tablename1>,<tablename2>

to create migration of whole schema,

yii migration/schema <schemaname>

yii2-reverse-migration