Skip to content

Kirby 4.4.1

Database

A simple database class

Example

Create a table

$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.