We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Db\Column with type Db\Column::TYPE_TIMESTAMP and DEFAULT value as NULL or 0

Hello,

How can i use Db\Column to create a field (using createTable method) with NULL or 0 value? Right now all variants cause an error and according zep code of method https://github.com/phalcon/cphalcon/blob/master/phalcon/db/dialect/mysql.zep default value wrapped by quotes. Temporary i've solved a problem by following way, but i'll be happy if someone can introduce a better solution.

        new Db\Column("active_to",
            [
                "type"    => Db\Column::TYPE_TIMESTAMP,
                'default' => '0000-00-00 00:00:00'
            ]
        ),

Thank you.



950

if you don't have a value to insert in table, you must save null in timestamp column, It's the best solution, because 0000-00-00 00:00:00 was when Jesus Christ born. OK? kkkkk