Skip to content

Rails5 fix AddMilestoneToLists migration rollback deleting wrong foreign key

What does this MR do?

Fix for AddMilestoneToLists reverse migration that didn't work correctly on Rails 5. The reverse(remove_reference) doesn't pass reference_name to remove_foreign_key when the foreign_key argument is a hash. See https://github.com/rails/rails/blob/2e824afc06011d5f75a7c964be007589771c89a5/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb#L845.

Fix is simply a separate down where we pass foreign_key: true which will pass the reference_name to remove_foreign_key.

Broken jobs in scheduled Rails 5 pipeline: https://gitlab.com/gitlab-org/gitlab-ee/-/jobs/87941148 https://gitlab.com/gitlab-org/gitlab-ee/-/jobs/87940751 https://gitlab.com/gitlab-org/gitlab-ee/-/jobs/87941203 https://gitlab.com/gitlab-org/gitlab-ee/-/jobs/87941253 https://gitlab.com/gitlab-org/gitlab-ee/-/jobs/87941053 ...

What are the relevant issue numbers?

Does this MR meet the acceptance criteria?

Edited by Rémy Coutable

Merge request reports