Really useful software project management and source code hosting.    tell me more...
BROWSE: projects / users / groups
  GROUP


Really Useful Social coding!

Codaset is an open system, so you can browse and search through all the open source projects, and check out what your friends are coding. Follow them, befriend them, and fork their code; quickly and easily.
Every single open source project you create is free, so come on and use Codaset at no cost. Your first private or semi-private project is also free. Read more about what it costs after that.

Git clone URL's...

Public: git://codaset.com/joelmoss/cakephp-db-migrations.git
Active tickets:
3
Milestones:
0
Bookmarks:
13
Forks:
0


CAKEPHP DATABASE MIGRATIONS

Database Migrations for CakePHP 1.2 is a shell script supported by the CakePHP console, that lets you
manage your database schema without touching one little bit of SQL. It is based on the Ruby on Rails
implementation of Migrations, and uses Pear's MDB2 package, so supports all the databases that that
supports.

You could think of Migrations as a version control system for your database. It's power lends itself
perfectly to developing as part of a team, as each member can keep their own independent copy of
their application's database, and use Migrations to make changes to its schema. All other members
have to do then, is to run a simple two word shell command, and their database copy is up to date
with everyone else's.

The Migrations shell will generate a migration file for each DB change you want to make. This file
can include any number of DB changes.

The Migration files support YAML and PHP array's. So instead of having to write SQL queries, you
can write a short YAML structure that will do the same thing:

create_table:
  users:
    name: string
    age: int
    is_active: bool

or the equivalent in a PHP array:

array(
  'create_table' =<blockquote class="citation"> array(</blockquote>
    'users' =<blockquote class="citation"> array(</blockquote>
      'name' =<blockquote class="citation"> array(</blockquote>
        'type' =<blockquote class="citation"> 'string'</blockquote>
      )
      'age' =<blockquote class="citation"> array(</blockquote>
        'type' =<blockquote class="citation"> 'int'</blockquote>
      )
      'is_active' =<blockquote class="citation"> array(</blockquote>
        'type' =<blockquote class="citation"> 'bool'</blockquote>
      )
    )
  )
)

The above YAML code will create a table called 'users'. This is equivalent to running the following
MySQL code:

CREATE TABLE users (
  id int(11) NOT NULL auto_increment,
  name varchar(255) default NULL,
  age int(11) default NULL,
  is_active tinyint(1) default NULL,
  created datetime default NULL,
  modified datetime default NULL,
  PRIMARY KEY  (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

This package also includes an extremely easy to use Fixtures shell that works seamlessly with
Migrations. Fixtures also use YAML and are a great way to insert test and/or development data
into your database.

Please check out the examples directory within this package.

Updates, new releases and other resources can be found at http://codaset.com/joelmoss/cakephp-db-migrations/
For further assistance and additional resources, please check out my Blog at http://developingwithstyle.com