$db
$db : \CodeIgniter\Database\BaseConnection
The active database connection.
Forge for MySQLi
$db : \CodeIgniter\Database\BaseConnection
The active database connection.
__construct(\CodeIgniter\Database\ConnectionInterface $db)
Constructor.
\CodeIgniter\Database\ConnectionInterface | $db |
getConnection() : \CodeIgniter\Database\ConnectionInterface
Provides access to the forge's current database connection.
addKey(string|array $key, boolean $primary = false, boolean $unique = false) : \CodeIgniter\Database\Forge
Add Key
string|array | $key | |
boolean | $primary | |
boolean | $unique |
addPrimaryKey(string|array $key) : \CodeIgniter\Database\Forge
Add Primary Key
string|array | $key |
addUniqueKey(string|array $key) : \CodeIgniter\Database\Forge
Add Unique Key
string|array | $key |
addField(array|string $field) : \CodeIgniter\Database\Forge
Add Field
array|string | $field |
addForeignKey(string $fieldName = '', string $tableName = '', string $tableField = '', string $onUpdate = '', string $onDelete = '') : \CodeIgniter\Database\Forge
Add Foreign Key
string | $fieldName | |
string | $tableName | |
string | $tableField | |
string | $onUpdate | |
string | $onDelete |
dropForeignKey(string $table, string $foreignName) : boolean|\CodeIgniter\Database\BaseResult|\CodeIgniter\Database\Query|false|mixed
Foreign Key Drop
string | $table | Table name |
string | $foreignName | Foreign name |
createTable(string $table, boolean $if_not_exists = false, array $attributes = array()) : mixed
Create Table
string | $table | Table name |
boolean | $if_not_exists | Whether to add IF NOT EXISTS condition |
array | $attributes | Associative array of table attributes |
dropTable(string $tableName, boolean $ifExists = false, boolean $cascade = false) : mixed
Drop Table
string | $tableName | Table name |
boolean | $ifExists | Whether to add an IF EXISTS condition |
boolean | $cascade | Whether to add an CASCADE condition |
_dropTable(string $table, boolean $if_exists, boolean $cascade) : string
Drop Table
Generates a platform-specific DROP TABLE string
string | $table | Table name |
boolean | $if_exists | Whether to add an IF EXISTS condition |
boolean | $cascade | Whether to add an CASCADE condition |
_attributeUnsigned(array $attributes, array $field) : null|void
Field attribute UNSIGNED
Depending on the unsigned property value:
array | $attributes | |
array | $field |