Upgrade Rails to 5.1
What does this MR do?
EE version: gitlab-org/gitlab-ee!9386
Upgrades Rails to latest 5.1 version. Biggest changes:
-
bigserial
is default primary key in the schema. -
build_select
changed to select only the required fields if the model hasignored_columns
. https://github.com/rails/rails/blob/5-1-stable/activerecord/lib/active_record/relation/query_methods.rb#L1041. This is incompatiple with some migrations or background migration specs because rails keeps a statement cache in memory. So if a model withignored_columns
in a migration is used, the query withselect table.col1, table.col2
is stored in the statement cache. If a different migration is then run and one of these columns is removed in the mean time, the query is invalid. Proper solution here is to not use the model but override it, like done in most migrations, but unfortunately not in all. Also for background migration specs you can clear all statement caches inreset_column_in_all_models
. I chose for a monkey patch because it seems not feasible to rewrite all migrations where rails model is used. -
Model.new.attributes
now also returns encrypted attribute. - There are still some places where
attribute_changed?
is used, these will be addressed in the follow-up issue: gitlab-ee#9932
What are the relevant issue numbers?
https://gitlab.com/gitlab-org/gitlab-ce/issues/48392#note_136387614
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated via this MR -
Documentation reviewed by technical writer or follow-up review issue created -
Tests added for this feature/bug -
Tested in all supported browsers -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides -
Link to e2e tests MR added if this MR has Requires e2e tests label. See the Test Planning Process. -
Security reports checked/validated by reviewer
Edited by Jasper Maes