traackr/sql-migration
Composer 安装命令:
composer require traackr/sql-migration
包简介
SQL migration plugin for CakePHP
README 文档
README
Introduction
This is a CakePHP plugin to manage database schema updates
Installation
To install this plugin you can:
- Clone the project on GitHub: https://github.com/Traackr/cakephp-sqlmigration. Make sure to clone in in your
app/Plugindirectory, preferably in a directory calledSqlMigration - Use Composer to manage this plugin as a dependency. To do this, simply add this to your
composer.jsonfile:
"minimum-stability": "dev",
"require": {
"traackr/sql-migration": "dev-master"
}
Requirements
All upgarde scripts are SQL scripts and are run via mysql therefore the mysql executable you want to use must be in your path for the plugin to work.
Setup
This plugin uses a database table (schema_versions) to keep track of schema upgrades. To get started you need to setup the plugin, which will create that table for you. Once the plugin is installed, simply do (in your app directory):
Console/cake SqlMigration.SqlMigration setup
It is safe to run this command multiple times. On subsequent calls, the command will simply try to apply any changes to the schema_versions table if any is requires (this might happen if/when you upgrade to a new version of this plugin).
Upgrade script
Upgarde scripts are simple SQL scripts and need to live in the following directory: app/Config/Sql.
Ths script's names must follow this naming convention: upgrade-<version-number>.sql
Running an upgrade
To run the upgrade scripts on your schema, simply call:
Console/cake SqlMigration.SqlMigration
The SqlMigration plugin will run all the upgrade scripts that have not been applied yet (based on the information found in the schema-versions table). The version numbers to not have to be continuous (ie. you can skip some versions), the plugin will apply the scripts in sequence and skip missing versions. If you later add a new upgrade scripts for any missing version (e.g. one was created in a branch and merged with the main core later), these scripts will be applied the next time you run the plugin (i.e. it will try to fill the gaps).
traackr/sql-migration 适用场景与选型建议
traackr/sql-migration 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 59.94k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2013 年 06 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 traackr/sql-migration 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 traackr/sql-migration 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 59.94k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2013-06-04