public
Description: Database migrations shell for CakePHP. NO LONGER MAINTAINED HERE. MOVED TO http://codaset.com/joelmoss/cakephp-db-migrations
Home | Edit | New

Column Types

CakePHP DB Migrations supports a number of column/field types. Most are self explanatory, but a few might need some explaining.

string text integer | int blob boolean | bool float date time timestamp | datetime fkey | fkeys

Here is an example of how you would use these types in conjunction with other attributes:

UP: add_field: users: last_name: type: string length: 10 DOWN: drop_field: users: last_name

Or better still, use the shortened format:

UP: add_field: users: last_name: 10 DOWN: drop_field: users: last_name

Because ‘string’ is the default type, we don’t need to specify it. But if we want ‘last_name’ to a integer with a limit of 5 (some people might!), do this:

UP: add_field: users: last_name: [int, 5] DOWN: drop_field: users: last_name
Last edited by joelmoss, Fri Nov 14 02:22:10 -0800 2008
Home | Edit | New
Versions: