gozoro/yii2-sql-migrations
最新稳定版本:v1.0.2
Composer 安装命令:
composer require gozoro/yii2-sql-migrations
包简介
Migration controller that works with sql-files ...up.sql and ...down.sql.
关键字:
README 文档
README
Migration controller that works with sql-files ...up.sql and ...down.sql.
Installation
composer require gozoro/yii2-sql-migrations
Configuration
Edit you config/console.php
... $config = [ ... 'components' => [ ... ], 'controllerMap' => [ 'migrate' => [ 'class' => 'gozoro\sql_migrations\MigrateController', //'migrationTable' => 'other_migration_table', //'migrationPath' => '@app/other_migration_path', //'db' => 'other_database_name' ], ], ... ]; return $config
Usage
Сreate your migration files in the directory that is specified in migrationPath.
File naming example:
- 01_create_table.up.sql
- 01_create_table.down.sql
- 02_insert_data.up.sql
- 02_insert_data.down.sql
Run migration:
./yii migrate/up
Commands
./yii help migrate
DESCRIPTION
Migration tool using sql-files ...up.sql and ...down.sql
File naming example:
- 01_create_table.up.sql
- 01_create_table.down.sql
- 02_insert_data.up.sql
- 02_insert_data.down.sql
To sort files well, you can add as many zeros to the beginning of the file name as needed.
SUB-COMMANDS
- migrate/down Downgrades the application by reverting old migrations.
- migrate/history Displays the migration history.
- migrate/new Displays the un-applied new migrations.
- migrate/redo Redoes the last few migrations.
- migrate/to Upgrades or downgrades till the specified version.
- migrate/up (default) Upgrades the application by applying new migrations.
To see the detailed information about individual sub-commands, enter:
yii help <sub-command>
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-10-18