Skip to content

Only allow add_reference for newly created tables

Andreas Brandl requested to merge ab/rubocop-add-reference into master

What does this MR do?

This disallows the use of add_reference on existing tables. It is only acceptable to be used if:

  1. The table in question is created with the same migration (because it's empty).
  2. The foreign key is created with an index, through index: true or similar.

Relates to: https://gitlab.com/gitlab-org/gitlab-ce/issues/67210

single codebase: Replaces CE MR: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/32881

Edited by 🤖 GitLab Bot 🤖

Merge request reports