Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project_authorization.rb')
-rw-r--r--app/models/project_authorization.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/project_authorization.rb b/app/models/project_authorization.rb
index 1fed166e4d0..64e768007ee 100644
--- a/app/models/project_authorization.rb
+++ b/app/models/project_authorization.rb
@@ -29,6 +29,15 @@ class ProjectAuthorization < ApplicationRecord
EOF
end
end
+
+ # This method overrides its ActiveRecord's version in order to work correctly
+ # with composite primary keys and fix the tests for Rails 6.1
+ #
+ # Consider using BulkInsertSafe module instead since we plan to refactor it in
+ # https://gitlab.com/gitlab-org/gitlab/-/issues/331264
+ def self.insert_all(attributes)
+ super(attributes, unique_by: connection.schema_cache.primary_keys(table_name))
+ end
end
ProjectAuthorization.prepend_mod_with('ProjectAuthorization')