For the basic template, a semi-working solution is to install [[https://github.com/Hzhihua/yii2-dump|yii2-dump]]\\

Basically you run
<code bash>
composer require --prefer-dist "hzhihua/yii2-dump:1.0.3"
</code>
and then
<code bash>
composer update -vv
</code>

In ''\config\console.php'' you can insert in ''config''
<code php>
    'controllerMap' => [
        'dump' => [
            'class' => 'hzhihua\dump\DumpController',
            'filePrefix' => '123456_654321',
            'tableOptions' => 'ENGINE=InnoDB CHARACTER SET=utf8 COLLATE=utf8_unicode_ci', // if mysql >= 5.7, you can set “ENGINE=InnoDB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_unicode_ci”,
        ],
    ],
</code>

See the commands available with
<code bash>
./yii help dump
</code>

You won't be able to generate a migration file directly because the ''generate'' command looks for the advanced template location but you can list out the ''createTable'' migration data in the terminal window with
<code bash>
./yii dump/create
</code>
and cut and paste into a migration file.




Back to [[yii|Yii Main Index]]