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

前端 未结 9 1440
执笔经年
执笔经年 2020-11-27 10:21

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 hav

9条回答
  •  遥遥无期
    2020-11-27 10:39

    In Laravel 5 simply:

    $table->timestamps(); //Adds created_at and updated_at columns.
    

    Documentation: http://laravel.com/docs/5.1/migrations#creating-columns

提交回复
热议问题