cycle/migrations
Composer 安装命令:
composer require cycle/migrations
包简介
Database migrations, migration scaffolding
README 文档
README
Migrations are a convenient way for you to alter your database in a structured and organized manner. This package adds additional functionality for versioning your database schema and easily deploying changes to it. It is a very easy to use and a powerful tool.
Installation
composer require cycle/migrations ^4.0
Configuration
use Cycle\Migrations; use Cycle\Database; use Cycle\Database\Config; $dbal = new Database\DatabaseManager(new Config\DatabaseConfig([ 'default' => 'default', 'databases' => [ 'default' => [ 'connection' => 'sqlite' ] ], 'connections' => [ 'sqlite' => new Config\SQLiteDriverConfig( connection: new Config\SQLite\MemoryConnectionConfig(), queryCache: true, ), ] ])); $config = new Migrations\Config\MigrationConfig([ 'directory' => __DIR__ . '/../migrations/', // where to store migrations 'vendorDirectories' => [ // Where to look for vendor package migrations __DIR__ . '/../vendor/vendorName/packageName/migrations/' ], 'table' => 'migrations' // database table to store migration status 'safe' => true // When set to true no confirmation will be requested on migration run. ]); $migrator = new Migrations\Migrator( $config, $dbal, new Migrations\FileRepository($config) ); // Init migration table $migrator->configure();
Running
while (($migration = $migrator->run()) !== null) { echo 'Migrate ' . $migration->getState()->getName(); }
Generate Migrations
You can automatically generate a set of migration files during schema compilation. In this case, you have the freedom to alter such migrations manually before running them. To achieve that you must install the Schema migrations generator extension.
License:
MIT License (MIT). Please see LICENSE for more information. Maintained
by Spiral Scout.
cycle/migrations 适用场景与选型建议
cycle/migrations 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 587.67k 次下载、GitHub Stars 达 20, 最近一次更新时间为 2019 年 03 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 cycle/migrations 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cycle/migrations 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 587.67k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 20
- 点击次数: 27
- 依赖项目数: 37
- 推荐数: 5
其他信息
- 授权协议: MIT
- 更新时间: 2019-03-29