-
Notifications
You must be signed in to change notification settings - Fork 19
apimigrationcreatetable
Troy Murray edited this page Sep 19, 2011
·
4 revisions
Creates a table definition object
t = createTable(name[,force,id,primaryKey]);
Parameter | Type | Required | Default | Description |
name | string | Yes | table name, in pluralized form | |
force | boolean | No | False | whether or not to drop table of same name before creating new one |
id | boolean | No | True | if false, defines a table with no primary key |
primaryKey | string | No | id | overrides default primary key name |
Note that the table will not be created in the database until you call the create function on the table definition object.
// 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');