Skip to content

[EE] Upgrade Rails to 5.1

Jasper Maes requested to merge jlemaes/gitlab-ee:rails5.1-ee into master

What does this MR do?

CE version: gitlab-org/gitlab-ce!24852

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 has ignored_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 with ignored_columns in a migration is used, the query with select 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 in reset_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: #9932 (closed)

What are the relevant issue numbers?

https://gitlab.com/gitlab-org/gitlab-ce/issues/48392#note_136387614

Does this MR meet the acceptance criteria?

Edited by Jasper Maes

Merge request reports