Book Image

CakePHP 2 Application Cookbook

Book Image

CakePHP 2 Application Cookbook

Overview of this book

Table of Contents (20 chapters)
CakePHP 2 Application Cookbook
Credits
Foreword
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

The Migrations plugin


The CakePHP schema shell provides basic database change management, but when your project complexity grows and you need more control over database changes, the CakeDC Migrations plugin is the way to go. Distributed under the MIT License, it's open source and totally free to use in your commercial projects.

Getting ready

We'll assume that you have a profiles table created in the database and the Profile model file in app/Model/Profile.php from our previous recipes.

First, install the CakeDC Migrations plugin either as a git submodule or by downloading the ZIP file and dropping the file contents under the app/Plugin/Migrations folder. Refer to the Including a plugin recipe from Chapter 1, Lightning Introduction, for more details.

Remember to also load this plugin in your app/Config/bootstrap.php file, adding the following line at the end of the file:

CakePlugin::load('Migrations');

Once the plugin is loaded, you'll have a new CakePHP shell provided by the plugin. You can check...