?>

How to generate yii2 migrations from a database?

How to generate yii2 migrations from a database?

We are talking about the fact that we have already done the project and have a database, but there are no migrations designed according to the rules of yii2.

To solve this problem, you can google and find a ready-made solution. Actually an example of using exactly one of the solutions.

1) Install into the project via composer

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

2) Update console / config / main.php

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

3) Generate a migration file on a table from the ssh console

yii migration/table your-table-name 

All Comments (0)
No Comments