gena litash
gena litash

Reputation: 23

How can i add default value when i want to create new table via console

I have shell command like this. Tell me please, how can i add default value to this query ?

bin/cake bake migration CreateProducts name:string description:text created modified

Upvotes: 1

Views: 1250

Answers (1)

ndm
ndm

Reputation: 60453

You can't, it's not supported, the column definition syntax is:

fieldName:fieldType?[length]:indexType:indexName

If you want to specify a default, then you need to add that to the migration file manually using the default option of the addColumn() method, like:

$table->addColumn('name', 'string', [
    'default' => 'default value',
    // ...
]);

See also

Upvotes: 2

Related Questions