-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
<?php
use Cycle\Migrations\Migration;
class example_table_0001 extends Migration {
protected const DATABASE = '[default]';
/**
* Create tables, add columns or insert data here
*/
public function up() {
$this->table('example_table');
->addColumn('created', 'timestamp', [
'nullable' => false,
'defaultValue' => \Cycle\Database\Injection\Fragment::__set_state(array(
'fragment' => 'CURRENT_TIMESTAMP',
)),
])
->create();
}
/**
* Drop created, columns and etc here
*/
public function down() {
$this->table('example_table')->drop();
}
};The defaultValue alias of default option is not picked up by hasOption() because it checks…
- If an option with requested name exists (it is not, but alias present).
- If requested name has aliases (it do have, but it is not a terminating check, if successful).
- If requested name is in the any list of aliases (it is not, but the option IS declared by an alias).
The check connecting 3 back to 2 is missing, thus declaring column with "defaultValue" simply skips default values entirely.
I did not hit it initially because of MariaDB 10.4 setting timestamp columns as … DEFAULT NOW(). 10.10 does not, and entire system collapses.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Backlog