tobento/app-migration
最新稳定版本:2.0.3
Composer 安装命令:
composer require tobento/app-migration
包简介
App migration support.
README 文档
README
App migration support.
Table of Contents
Getting Started
Add the latest version of the app migration project running this command.
composer require tobento/app-migration
Requirements
- PHP 8.4 or greater
Documentation
App
Check out the App Skeleton if you are using the skeleton.
You may also check out the App to learn more about the app in general.
Migration Boot
The migration boot does the following:
- definition of \Tobento\Service\Migration\MigratorInterface::class
- definition of \Tobento\Service\Migration\MigrationResultsInterface::class
- installs and loads migration config file
- adds install and uninstall app macros
use Tobento\App\AppFactory; // Create the app $app = new AppFactory()->createApp(); // Adding boots $app->boot(\Tobento\App\Migration\Boot\Migration::class); // Run the app $app->run();
Install and Uninstall Migration
Once the Migration Boot has been booted you may install migrations by the following ways:
use Tobento\App\Boot; use Tobento\App\Migration\Boot\Migration; class AnyServiceBoot extends Boot { public const BOOT = [ // you may ensure the migration boot. Migration::class, ]; public function boot(Migration $migration) { // Install migrations $migration->install(AnyMigration::class); // Uninstall migrations $migration->uninstall(AnyMigration::class); // Install migrations with app macro $this->app->install(AnyMigration::class); // Uninstall migrations with app macro $this->app->uninstall(AnyMigration::class); } }
Create Migration
Check out the Migration Service to learn more about creating migration classes.
Replace Migration
You may replace a migration with another migration using the replace method:
use Tobento\App\Boot; use Tobento\App\Migration\Boot\Migration; class AnyServiceBoot extends Boot { public const BOOT = [ // you may ensure the migration boot. Migration::class, ]; public function boot(Migration $migration) { $migration->replace( SomeMigration::class, ReplaceWithThisMigration::class ); } }
Console
If you have installed the App Console you may run the following commands.
Migration List Command
The migration:list command provides an overview of all the migrations installed:
php ap migration:list
Migration Install Command
Install a migration by its class:
php ap migration:install --name=Namespace\Migration
Reinstalls all migrations:
php ap migration:install --all
Reinstalls specific migration(s) or/and action(s) by its ids. To get the ids, run migration:list command:
php ap migration:install --id=12|23
Reinstalls specific migration(s) or/and action(s) by its type.
php ap migration:install --type=database|views
Migration Uninstall Command
Uninstall a migration by its class:
php ap migration:uninstall --name=Namespace\Migration
Uninstalls all migrations:
php ap migration:uninstall --all
Uninstalls specific migration(s) by its ids. To get the ids, run migration:list command:
php ap migration:uninstall --id=12|23
Credits
统计信息
- 总下载量: 239
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 32
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-03-30