Skip to content

Support rails5 in postgres indexes function and fix some migrations

Jasper Maes requested to merge jlemaes/gitlab-ce:rails5-fix-46236 into master

What does this MR do?

The changes in postgresql_opclasses_support.rb and 20160226114608_add_trigram_indexes_for_searching.rb are a backport of https://github.com/rails/rails/commit/1d8d5a74b81b8aab1f5e6d233d509a92525ed4e1#diff-6e377cf054cb4121e6f207bd7c14b492.

The change to 20170622135728_add_unique_constraint_to_ci_variables.rb is needed because migrations now include compatibility: https://github.com/rails/rails/blob/5-0-stable/activerecord/lib/active_record/migration/compatibility.rb#L87 and this line call the index_name as a function.

The change to 20180201110056_add_foreign_keys_to_todos.rb is needed because https://github.com/rails/rails/commit/6bd777c85156aca0cf2d1f34d8c1fe37d96ac3d9 changed the foreign key check to first check on column instead of checking the name, and this new check returns the author_id foreign key.

The change to 20171106155656_turn_issues_due_date_index_to_partial_index.rb is needed because https://github.com/rails/rails/commit/9771f5e178ebc1b8c5a61f813373ca3b7bd983c8#diff-a0775e1ec64264dc76a8ee71a5211ae3 broke the index_exists? method for column name nil

With these changes RAILS5=1 bin/rails db:migrate works fine. Schema dumping does not work yet because of the added support of comments on indexes.

Are there points in the code the reviewer needs to double check?

Should I split this MR into seperate ones? Made sense to do it like this until RAILS5=1 bin/rails db:migrate worked and most background migration specs passed.

Why was this MR needed?

rails5 upgrade

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #46236 (closed)

Edited by Yorick Peterse

Merge request reports