public
Description: Database migrations shell for CakePHP. NO LONGER MAINTAINED HERE. MOVED TO http://codaset.com/joelmoss/cakephp-db-migrations
Homepage: http://codaset.com/joelmoss/cakephp-db-migrations
Clone URL: git://github.com/joelmoss/cakephp-db-migrations.git
cakephp-db-migrations / README.md
ef4ce172 » joelmoss 2008-11-02 README now foramatted with ... 1 ### CAKEPHP DATABASE MIGRATIONS
8fa6c05b » joel@joelmoss.info 2008-02-01 Initial import 2
0212a5d7 » joelmoss 2008-11-13 Updated readme and install ... 3 **NOTE** To download the latest stable release, you should use the latest tag: [http://github.com/joelmoss/cakephp-db-migrations/downloads/4.0](http://github.com/joelmoss/cakephp-db-migrations/downloads/4.0)
4
8fa6c05b » joel@joelmoss.info 2008-02-01 Initial import 5 Database Migrations for CakePHP 1.2 is a shell script supported by the CakePHP console, that lets you
6 manage your database schema without touching one little bit of SQL. It is based on the Ruby on Rails
7 implementation of Migrations, and uses Pear's MDB2 package, so supports all the databases that that
8 supports.
9
10 You could think of Migrations as a version control system for your database. It's power lends itself
11 perfectly to developing as part of a team, as each member can keep their own independent copy of
12 their application's database, and use Migrations to make changes to its schema. All other members
13 have to do then, is to run a simple two word shell command, and their database copy is up to date
14 with everyone else's.
15
16 The Migrations shell will generate a migration file for each DB change you want to make. This file
17 can include any number of DB changes.
18
3ff270f9 » joelmoss 2008-05-20 First beta release of Migra... 19 The Migration files support YAML and PHP array's. So instead of having to write SQL queries, you
20 can write a short YAML structure that will do the same thing:
8fa6c05b » joel@joelmoss.info 2008-02-01 Initial import 21
ef4ce172 » joelmoss 2008-11-02 README now foramatted with ... 22 create_table:
23 users:
24 name: string
25 age: int
26 is_active: bool
3ff270f9 » joelmoss 2008-05-20 First beta release of Migra... 27
28 or the equivalent in a PHP array:
29
ef4ce172 » joelmoss 2008-11-02 README now foramatted with ... 30 array(
31 'create_table' => array(
32 'users' => array(
33 'name' => array(
34 'type' => 'string'
35 )
36 'age' => array(
37 'type' => 'int'
38 )
39 'is_active' => array(
40 'type' => 'bool'
41 )
3ff270f9 » joelmoss 2008-05-20 First beta release of Migra... 42 )
43 )
44 )
8fa6c05b » joel@joelmoss.info 2008-02-01 Initial import 45
46 The above YAML code will create a table called 'users'. This is equivalent to running the following
47 MySQL code:
48
ef4ce172 » joelmoss 2008-11-02 README now foramatted with ... 49 CREATE TABLE users (
50 id int(11) NOT NULL auto_increment,
51 name varchar(255) default NULL,
52 age int(11) default NULL,
53 is_active tinyint(1) default NULL,
54 created datetime default NULL,
55 modified datetime default NULL,
56 PRIMARY KEY (id)
57 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
8fa6c05b » joel@joelmoss.info 2008-02-01 Initial import 58
59 This package also includes an extremely easy to use Fixtures shell that works seamlessly with
60 Migrations. Fixtures also use YAML and are a great way to insert test and/or development data
61 into your database.
62
63
64
65 Please check out the examples directory within this package.
66
ef4ce172 » joelmoss 2008-11-02 README now foramatted with ... 67 Updates, new releases and other resources can be found at [http://code.google.com/p/cakephp-migrations/](http://code.google.com/p/cakephp-migrations/)
68 For further assistance and additional resources, please check out my Blog at [http://developingwithstyle.com](http://developingwithstyle.com)