Mark the `created_at` attribute as read-only to prevent updating it
What does this MR do and why?
ActiveRecord's InsertAll
module updates the created_at
attributes for the UPSERT queries if the attribute is not marked as read-only. This MR changes the BulkInsertSafe
module to mark the created_at
attribute as read-only for the models including it.
I've tried to mark all the created_at
attributes as read-only in the ApplicationRecord
but seems like updating the created_at
attribute in specs is a common thing which causes lots of failures in specs.
Monkey patching the InsertAll
module can be another approach but we had some problems in the past related to it so I think this is a clearer solution.
Related to #341839 (closed).
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.