Laravel 5.4 ON UPDATE CURRENT_TIMESTAMP, how?

Viewed 5748

Please help me to understand how to do this in Laravel 5.4. Can't google this.

CREATE TABLE t1 (
  dt DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

This is not working:

$table->dateTime('dt')
        ->default(DB::raw('CURRENT_TIMESTAMP'))
        ->onUpdate(DB::raw('CURRENT_TIMESTAMP'));

The question is about THIS PART:

ON UPDATE CURRENT_TIMESTAMP

SOLVED:

Well, solution was simple :/

$table->dateTime('updated')
        ->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'))
0 Answers
Related