参考: https://stackoverflow.com/questions/18962757/when-is-a-timestamp-auto-updated
核心:
DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
![[MySQL]如何自动更新timestap_laravel migrate](https://file.cfanz.cn/uploads/png/2022/08/04/13/6RddeF0KSf.png)
![[MySQL]如何自动更新timestap_laravel migrate_02](https://file.cfanz.cn/uploads/png/2022/08/04/13/346V996f7T.png)
结合laravel migrate:
$table->timestamp('created_at')->useCurrent();
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));










