frankfoerster/cakephp-migrations

CakePHP 迁移插件

v1.0.0 2015-04-29 12:27 UTC

This package is auto-updated.

Last update: 2024-09-12 03:55:09 UTC


README

Build Status

CakePHP 2.3+ 迁移插件

此迁移插件基于 "CakeDC/migrations" 的工作:https://github.com/CakeDC/migrations

重写的目标主要有:

  • 将迁移命令移动到它们自己的函数 "up" 和 "down" 中
  • 使所有迁移操作尽可能原子化,以便于测试
  • 在迁移中使用 PHP + CakePHP 方法、模型
  • 由于迁移是方法调用,因此不需要 "before" 或 "after" 回调
  • 移除迁移映射,而是使用带数字和日期时间前缀的文件名加唯一的迁移类名

要求

PHP 5.3+ CakePHP 2.3+

安装

通过 composer

composer require frankfoerster/cakephp-migrations:~1.0

在您的 app/Config/bootstrap.php 中添加

CakePlugin::load('Migrations', array('bootstrap' => false, 'routes' => false));

通过 Shell 使用

cd app
Console/cake Migrations.Migration migrate up
Console/cake Migrations.Migration migrate down
Console/cake Migrations.Migration migrate down 1

许可证

版权所有 (c) Frank Förster (frankfoerster)

许可协议为 MIT 许可证。文件的分发必须保留上述版权声明。