tmukherjee13/yii2-reverse-migration

从现有数据库生成工作迁移类

2.4.0 2021-07-24 13:46 UTC

This package is auto-updated.

Last update: 2024-09-07 16:38:12 UTC


README

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

从现有数据库生成工作迁移类

安装

安装此扩展的首选方法是使用 composer

可以运行

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

或者在您的 composer.json 文件的 require 部分添加

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

to

使用

一旦安装了扩展,请在 console.php 中添加以下内容

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

然后您可以按以下方式使用迁移命令

用于表迁移

yii migration/table <tablename>

yii migration/table <tablename1>,<tablename2>

用于数据迁移

yii migration/data <tablename>

yii migration/data <tablename1>,<tablename2>

以创建整个架构的迁移

yii migration/schema <schemaname>

yii2-reverse-migration