migrations plugin 应用研究

一. 对程序目录有要求, 应用程序 app 的目录必须与 cake 框架的程序包在同一目录下

二. 从以下的第四部开始, 就会有一些 bug:

    步骤:

        1. Generate your first Migration (if haven’t generated yet).

        2. Generate a schema file.                                       

        3. Do changes to your database

        4. Generate a new migration file.

    1. 对没有做修改的数据表, 新的迁移版本会直接删除.

    2. 如果新的迁移版本名字与老的一样, 在升级迁移版本时候会报错, 升级失败.

    3. 当修改表字段名称时候, 它会去删除旧名称字段, 新增新名称字段, 但目前还不支持 Add Field.

三. 从目前来看, 这个插件是个半成品, 这个版本Released on:2010-01-11, 更新缓慢, 不建议使用.

 

附录(帮助文档):

—————————————————————

Cake Migration Shell

—————————————————————

The Migration database management for CakePHP

—————————————————————

Usage: cake migration <command> <param1> <param2>…

—————————————————————

Params:

    -connection <config>

        Set db config <config>. Uses ’default’ if none is specified.

    -plugin

        Plugin name to be used

    -f

        Force ’generate’ to compare all tables.

Commands:

    migration help

        Shows this help message.

    migration run <up|down|all|reset|version>

        Run a migration to given direction or version.

        Provide a version number to get directly to the version.

        You can also use all to apply all migrations or reset to unapply all.

    migration <generate|add>

        Generates a migration file.

        To force generation of all tables when making a comparison/dump, use the -f param.

原文地址:https://www.cnblogs.com/uniqid/p/4154636.html