How Can I Set the Default Value of a Timestamp Column to the Current Timestamp with Laravel Migrations?

I would like to make a timestamp column with a default value of CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP using the Laravel Schema Builder/Migrations. I have gone through the Laravel documentation several times, and I don’t see how I can make that the default for a timestamp column.

The timestamps() function makes the defaults 0000-00-00 00:00 for both columns that it makes.

11 Answers
11

Leave a Comment