CI_DB_forge

class CI_DB_forge

add_column($table[, $field = array()[, $_after = NULL]])
Parameters:
  • $table (string) – Table name to add the column to
  • $field (array) – Column definition(s)
  • $_after (string) – Column for AFTER clause (deprecated)
Returns:

TRUE on success, FALSE on failure

Return type:

bool

Adds a column to a table. Usage: See Adding a Column to a Table.

add_field($field)
Parameters:
  • $field (array) – Field definition to add
Returns:

CI_DB_forge instance (method chaining)

Return type:

CI_DB_forge

Adds a field to the set that will be used to create a table. Usage: See Adding fields.

add_key($key[, $primary = FALSE])
Parameters:
  • $key (array) – Name of a key field
  • $primary (bool) – Set to TRUE if it should be a primary key or a regular one
Returns:

CI_DB_forge instance (method chaining)

Return type:

CI_DB_forge

Adds a key to the set that will be used to create a table. Usage: See Adding Keys.

create_database($db_name)
Parameters:
  • $db_name (string) – Name of the database to create
Returns:

TRUE on success, FALSE on failure

Return type:

bool

Creates a new database. Usage: See Creating and Dropping Databases.

create_table($table[, $if_not_exists = FALSE[, array $attributes = array()]])
Parameters:
  • $table (string) – Name of the table to create
  • $if_not_exists (string) – Set to TRUE to add an ‘IF NOT EXISTS’ clause
  • $attributes (string) – An associative array of table attributes
Returns:

TRUE on success, FALSE on failure

Return type:

bool

Creates a new table. Usage: See Creating a table.

drop_column($table, $column_name)
Parameters:
  • $table (string) – Table name
  • $column_name (array) – The column name to drop
Returns:

TRUE on success, FALSE on failure

Return type:

bool

Drops a column from a table. Usage: See Dropping a Column From a Table.

drop_database($db_name)
Parameters:
  • $db_name (string) – Name of the database to drop
Returns:

TRUE on success, FALSE on failure

Return type:

bool

Drops a database. Usage: See Creating and Dropping Databases.

drop_table($table_name[, $if_exists = FALSE])
Parameters:
  • $table (string) – Name of the table to drop
  • $if_exists (string) – Set to TRUE to add an ‘IF EXISTS’ clause
Returns:

TRUE on success, FALSE on failure

Return type:

bool

Drops a table. Usage: See Dropping a table.

modify_column($table, $field)
Parameters:
  • $table (string) – Table name
  • $field (array) – Column definition(s)
Returns:

TRUE on success, FALSE on failure

Return type:

bool

Modifies a table column. Usage: See Modifying a Column in a Table.

rename_table($table_name, $new_table_name)
Parameters:
  • $table (string) – Current of the table
  • $new_table_name (string) – New name of the table
Returns:

TRUE on success, FALSE on failure

Return type:

bool

Renames a table. Usage: See Renaming a table.

doc_CodeIgniter
2016-10-15 16:31:09
Comments
Leave a Comment

Please login to continue.