Migration to remove default value and ON UPDATE CURRENT_TIMESTAMP()
Hi, I have a table with a timestamp field that has the default value to current_timestamp() and ON UPDATE CURRENT_TIMESTAMP() listed as extra. The ON UPDATE CURRENT_TIMESTAMP() is definitely causing me issues right now so I need to add a migration to remove this.
Can anyone guide me as to which migration I should use in this case?
Yeah! sure , try with this any one as you needed
this will disable both time stamp created_at and as well as updated_at
place this in your tables model file
public $timestamps = false;
or try this for disabel timestamps
$table->timestamps();
or try this ,and add manually created_at
$table->timestamp('created_at');
and then re run the migration command ..or rollback them first and re migrate it with a single command
and I think when you assign a value for timestamp, it will not assign the current timestamp on update because of it is not using the default value anymore.