We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

TIMESTAMP DEFAULT NULL

How create column TIMESTAMP DEFAULT NULL?

new Column('created_at', [
    'type' => Column::TYPE_TIMESTAMP,
    'notNull' => false
]),

not work

new Column('created_at', [
    'type' => Column::TYPE_TIMESTAMP,
    'notNull' => false,
    'default' => "NULL"
]),

not work too



11.0k
Accepted
answer
edited Nov '16

use a raw value

new Column('created_at', [
    'type' => new RawValue('default'),
    'notNull' => false,
    'default' => "NULL"
]),

https://docs.phalcon.io/en/latest/reference/models.html#skipping-columns