swisscom/commandmigration
Composer 安装命令:
composer require swisscom/commandmigration
包简介
Neos Flow package for framework based CLI command migrations
README 文档
README
Neos Flow package for framework based CLI command migrations.
The package allows to create migration scripts similar to Doctrine migrations. Contrary to executing SQL statements, it allows you to define versions with sets of Flow CLI commands. Those are executed when running the migration by the command ./flow commandmigration:migrate.
This mainly solves the problem of executing one-off commands on distributed environments as well as different staging environments. Without this package, those one-off commands are possibly executed manually when needed, or are part of some other scripts in your deployment process. With this package, this becomes part of the code base. For integration, the migration command might be added to your deployment strategy the same way as the ./flow doctrine:migrate command probably already is.
Usage
Create migrations
To create a migration inherit from the AbstractMigration with the naming convention VersionYmdHis and implent the up() method. The class has to be within the namespace Swisscom\CommandMigration and be stored in your package under Migrations/Command/.
Example migration Packages/Your.Package/Migrations/Command/Version20200220114245.php:
<?php
namespace Swisscom\CommandMigration;
/**
* A test migration
*/
class Version20200220114245 extends AbstractMigration
{
/**
* @return void
*/
public function up(): void
{
$this->addCommand('your:command', ['test' => true]);
}
}
Executing commands
The provided commands follow the naming of the familiar Doctrine commands and work in likewise manner:
| Command identifier | Description |
|---|---|
| commandmigration:migrate | Execute the pending migrations |
| commandmigration:migrationexecute | Execute a single migration |
| commandmigration:migrationstatus | Show the current migration status |
| commandmigration:migrationversion | Mark/unmark migrations as migrated |
Notes
The package is highly inspired by the Flow Doctrine migrations and the Flow code migrations. Some logic, semantics as well as code is borrowed from those core modules.
swisscom/commandmigration 适用场景与选型建议
swisscom/commandmigration 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 35.66k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2020 年 03 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 swisscom/commandmigration 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 swisscom/commandmigration 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 35.66k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-03-23