Directive - Create Table

Details

Name: create_table

Format: array of Tables

Description

Create table is used for the creation of new tables in your database.

Note that migrations will generate errors if the specified table already exists in the database.

Directives exist (Drop, Rename) to deal with existing tables before proceeding with table creation.

Example


'create_table' => array(
	'categories' => array(
		'id' => array(
			'type'    =>'string',
			'null'    => false,
			'default' => NULL,
			'length'  => 36,
			'key'     => 'primary'),
		'name' => array(
			'type'    =>'string',
			'null'    => false,
			'default' => NULL),
		'indexes' => array(
			'PRIMARY' => array(
				'column' => 'id',
				'unique' => 1)
		)
	),
	'emails' => array(
		'id' => array(
			'type'    => 'string',
			'length ' => 36,
			'null'    => false,
			'key'     => 'primary'),
		'data' => array(
			'type'    => 'text',
			'null'    => false,
			'default' => NULL),
		'sent' => array(
			'type'    => 'boolean',
			'null'    => false,
			'default' => '0'),
		'error' => array(
			'type'    => 'text',
			'default' => NULL),
		'created' => array(
			'type' => 'datetime'),
		'modified' => array(
			'type' => 'datetime'),
		'indexes' => array(
			'PRIMARY' => array(
				'column' => 'id',
				'unique' => 1)
		)
	)
)