diff options
Diffstat (limited to 'rubocop/cop/migration/prevent_index_creation.rb')
-rw-r--r-- | rubocop/cop/migration/prevent_index_creation.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/rubocop/cop/migration/prevent_index_creation.rb b/rubocop/cop/migration/prevent_index_creation.rb index 4c39032eb0f..aa0ab7b1e50 100644 --- a/rubocop/cop/migration/prevent_index_creation.rb +++ b/rubocop/cop/migration/prevent_index_creation.rb @@ -8,9 +8,11 @@ module RuboCop class PreventIndexCreation < RuboCop::Cop::Base include MigrationHelpers - FORBIDDEN_TABLES = %i[ci_builds].freeze + FORBIDDEN_TABLES = %i[ci_builds namespaces].freeze - MSG = "Adding new index to #{FORBIDDEN_TABLES.join(", ")} is forbidden, see https://gitlab.com/gitlab-org/gitlab/-/issues/332886".freeze + MSG = "Adding new index to #{FORBIDDEN_TABLES.join(", ")} is forbidden. " \ + "For `ci_builds` see https://gitlab.com/gitlab-org/gitlab/-/issues/332886, " \ + "for `namespaces` see https://gitlab.com/groups/gitlab-org/-/epics/11543".freeze def on_new_investigation super @@ -40,6 +42,9 @@ module RuboCop def on_def(node) return unless in_migration?(node) + direction = node.children[0] + return if direction == :down + node.each_descendant(:send) do |send_node| add_offense(send_node.loc.selector) if offense?(send_node) end |