-
Notifications
You must be signed in to change notification settings - Fork 8
Labels
bugSomething isn't workingSomething isn't workingconfirmedHas been confirmed by maintainersHas been confirmed by maintainers
Description
Package Version
0.6.0
Php Version
8.3
Database Engine
MySQL
Basic Information
When using the DDL scripts, it would be the most sane default to allow nullable columns to have a NULL default value. However if nullable is true and no default is given, no default value is assigned when creating the SQL.
Steps to Reproduce
use PhpDb\Sql\Ddl\Column\Varchar;
use PhpDb\Sql\Ddl\CreateTable;
$table = new CreateTable('users');
$table->addColumn(
(new Varchar('mycol', 100))
->setNullable(true)
);
echo $table->getSqlString();Expected Behavior
CREATE TABLE `users` (
`mycol` VARCHAR(100) NULL DEFAULT NULL
)Actual behavior?
CREATE TABLE `users` (
`nickname` VARCHAR(100)
)Additional Info
It seems this behaviour has been present since Laminas Db days
Also note that if setDefault() is present it will use that value instead, so adding setDefault('myval') will override this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingconfirmedHas been confirmed by maintainersHas been confirmed by maintainers
Type
Projects
Status
Done