Sorry if this has been answered before but I can't find a definite answer.
Surely someone has come across this issue when using upsert
you need to specify every column including created_at
and updated_at
?
How can I not update the created_at
timestamp when an upsert happens? I only want to insert created_at
once.
a = User.upsert({
name: ....,
age: ....
created_at: DateTime.now,
updated_at: DateTime.now
}, unique_by: :upsert_user_index )