DDL

Patio supports the creation to tables through an instance of patio.Database. The createTable method is used by passing it a name of the table to create and a function which performs the actions to create columns, indexes, foreignKeys, constraints, and primaryKeys.

primaryKey : Make the column as a single primary key column. This should only be used if you have a single, non-autoincrementing primary key column.

size : The size of the column, generally used with string columns to specify the maximum number of characters the column will hold. An array of two integers can be provided to set the size and the precision, respectively, of decimal columns.

unique : Mark the column as unique, generally has the same effect as creating a unique index on the column.

unsigned : Make the column type unsigned, only useful for integer columns.

deferrable : Makes the foreign key constraint checks deferrable, so they aren't checked until the end of the transaction.

key : For foreign key columns, the column in the associated table that this column references. Unnecessary if this column references the primary key of the associated table, at least on most databases.

This method adds a column to the table. This method is similar to createTable's column method where the first parameter is the column and the second parameter is the data type and third parameter an optional options hash

Forcibly creates a table, attempting to drop it unconditionally (and catching any errors), then creating it. Note: This should not be used within a transaction as it could cause the transaction to fail.