We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 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