cakePHP Migration plugin


Why Migration of database needed  ?

Assume when Two person working in same project .. They may work from different place..

Version GIT, SVN etc will helps to merge both of our files and work in same flow.. But we

need to update database. They cannot delete and create database on every merge or update

in project.. They should update database in same flow.

As we know in cakePHP we have schema generation. This will delete and create database

on every migration .. We cannot move up , or down migration..

To solve this problem, We have Migration plugin in cakePHP.

Here as in rails , this will provide easy way to version database.

Here first we should create database by our own .

Consider sample is your application name

Go to plugins folder

 cd /sample/app/plugins
 git clone https://github.com/CakeDC/migrations.git
Initialized empty Git repository in /var/www/sample/app/plugins/migrations/.git/
cd ..

In /sample/app folder.

Type following command

cake migration generate
Welcome to CakePHP v1.3.7 Console
---------------------------------------------------------------
App : app
Path: /var/www/workspace/sample/app
---------------------------------------------------------------
Cake Migration Shell
---------------------------------------------------------------
Please enter the descriptive name of the migration to generate: 
> 
200720011_intial_migration

Give any name of file you want save.. basically timestamp_filename

Do you want compare the schema.php file to the database? (y/n) 
[y] > n
Generating Migration...
Mapping Migrations...

Done.

First there will be nothing in schema migrtion , so you give no.                                                                                                           

Continuation on https://sathia27.wordpress.com/2011/07/28/continuation-of-migration-plugin/

Advertisements

About sathia

Web developer at cloudmint
This entry was posted in Web and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s