Don't update the `created_at` values by the UPSERT queries
Why are we doing this work
As Rails's InsertAll module is updating the created_at
attribute for the UPSERT queries on conflict, we are overriding the values of created_at
whenever we use the InsertSafe
module or ActiveRecord
interface directly.
We can mark the created_at
attributes as read-only to prevent them from being updated.
Relevant links
- The PR which introduced the bulk insert for Rails
Implementation plan
-
backend Mark the created_at
attribute as read-only on ApplicationRecord to prevent updating its value
Edited by Thiago Figueiró