Skip to content

apimigrationcreatetable

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

createTable()

Usage

Creates a table definition object

Function Syntax

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

Parameters

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

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