it wont mess with your columns?
Mar 19, 2018
3
Level 1
How can I stop Laravel from making timestamps `on update CURRENT_TIMESTAMP`?
I understand this default value existing on the created_at and updated_at columns, but why on every timestamp? How do I disable this default behaviour for my own timestamp columns?
Level 67
You need to make the datetime column nullable, then mysql won't add that. By default, mysql adds that to the first timestamp in the table, unless explicitly told not to (via allowing a null value for the field). This is a mysql thing, not a laravel thing.
$table->timestamp('colName')->nullable();
https://dev.mysql.com/doc/refman/5.7/en/timestamp-initialization.html
Edit: I knew I read about this somewhere when it comes to laravel: https://ma.ttias.be/laravel-mysql-auto-adding-update-current_timestamp-timestamp-fields/
5 likes
Please or to participate in this conversation.