$database->createTable()
Creates a new table
$database->createTable(string $table, array $columns = [ ]): bool
Parameters
Name | Type | Default |
---|---|---|
$table * | string |
– |
$columns | array |
[ ] |
Return type
bool
Parent class
Example
$database->createTable('product', [
'id' => ['type' => 'id'],
'code' => ['type' => 'varchar', 'size' => 50],
'description' => ['type' => 'varchar'],
'quantity' => ['type' => 'int', 'unsigned' => false],
'price' => ['type' => 'decimal', 'precision' => 12, 'decimal_places' => 4]
]);
Since 4.2.0
Newly added options are the unsigned
option for integers and size
option for varchars as well as the float
and decimal
types.