Skip to content

apimigrationcreatetable

Troy Murray edited this page Sep 15, 2011 · 4 revisions

Migration :: createTable function

Usage

Creates a table definition object

t = createTable(name[,force,id,primaryKey]);

Parameters

Parameter Required Default Description name Yes table name, in pluralized form force No False boolean, whether or not to drop table of same name before creating new one id No True boolean, if false, defines a table with no primary key primaryKey No id string, overrides default primary key name Notes Note that the table will not be created in the database until you call the create function on the table definition object.

Examples

// basic create table
t = createTable('members');

// force table to be dropped, if exists, before creating
t = createTable(name='members',force=true);

// create table with no primary key
// (e.g. can be used for hasMany relationship joining tables)
t = createTable(name='membermailinglists',id=false);

// create a table with a different primary key name
t = createTable(name='members',primaryKey='memberId');
Clone this wiki locally