Create Statement
Create a Database table.
$db::create('product_users')
->column('ID')->bigInt()->unsigned()->autoIncrement()->primary()->required()
->column('name')->string(255)->required()
->column('email')->string(255)->nullable()
->column('bio')->json()->required()
->column('settings')->enum(['active', 'inactive'])
->column('created_at')->timestamp('now')
->column('updated_at')->timestamp('now', 'current')
->execute();
Use of foreignKey
DB::create('howdy_qb')
->column('name')->string(255)->required()
->column('email')->string(255)->required()
->column('howdyID')->bigInt()->unsigned()
->column('created_at')->dateTime()->default('0000-00-00 00:00:00')
->foreignKey('howdyID', 'users.ID', 'cascade')
->index(['howdyID'])
->execute();
Get raw SQL without database query execution.
$sql = $db::create('howdy_qb')
->column('name')->string(255)->required()
->column('bio')->json()->required()
->column('howdyID')->bigInt()->unsigned()
->getSql();