Commit b003363e authored by Thong Kuah's avatar Thong Kuah

Suppress composite primary key warning

These are all known cases, and there's no harm in the composite pk, so
we can stop emit this warnings for these models
parent 6f420923
......@@ -2,6 +2,7 @@
module Ci
class BuildTraceSection < ApplicationRecord
extend SuppressCompositePrimaryKeyWarning
extend Gitlab::Ci::Model
belongs_to :build, class_name: 'Ci::Build'
......
# frozen_string_literal: true
# When extended, silences this warning below:
# WARNING: Active Record does not support composite primary key.
#
# project_authorizations has composite primary key. Composite primary key is ignored.
#
# See https://gitlab.com/gitlab-org/gitlab/-/issues/292909
module SuppressCompositePrimaryKeyWarning
extend ActiveSupport::Concern
private
def suppress_composite_primary_key(pk)
silence_warnings do
super
end
end
end
# frozen_string_literal: true
class DeploymentMergeRequest < ApplicationRecord
extend SuppressCompositePrimaryKeyWarning
belongs_to :deployment, optional: false
belongs_to :merge_request, optional: false
......
# frozen_string_literal: true
class IssueAssignee < ApplicationRecord
extend SuppressCompositePrimaryKeyWarning
belongs_to :issue
belongs_to :assignee, class_name: "User", foreign_key: :user_id, inverse_of: :issue_assignees
......
# frozen_string_literal: true
class MergeRequestContextCommitDiffFile < ApplicationRecord
extend SuppressCompositePrimaryKeyWarning
include Gitlab::EncodingHelper
include ShaAttribute
include DiffFile
......
# frozen_string_literal: true
class MergeRequestDiffCommit < ApplicationRecord
extend SuppressCompositePrimaryKeyWarning
include BulkInsertSafe
include ShaAttribute
include CachedCommit
......
# frozen_string_literal: true
class MergeRequestDiffFile < ApplicationRecord
extend SuppressCompositePrimaryKeyWarning
include BulkInsertSafe
include Gitlab::EncodingHelper
include DiffFile
......
# frozen_string_literal: true
class MilestoneRelease < ApplicationRecord
extend SuppressCompositePrimaryKeyWarning
belongs_to :milestone
belongs_to :release
......
# frozen_string_literal: true
class ProjectAuthorization < ApplicationRecord
extend SuppressCompositePrimaryKeyWarning
include FromUnion
belongs_to :user
......
# frozen_string_literal: true
class ProjectPagesMetadatum < ApplicationRecord
extend SuppressCompositePrimaryKeyWarning
include EachBatch
self.primary_key = :project_id
......
# frozen_string_literal: true
class PushEventPayload < ApplicationRecord
extend SuppressCompositePrimaryKeyWarning
include ShaAttribute
belongs_to :event, inverse_of: :push_event_payload
......
# frozen_string_literal: true
class RepositoryLanguage < ApplicationRecord
extend SuppressCompositePrimaryKeyWarning
belongs_to :project
belongs_to :programming_language
......
# frozen_string_literal: true
class UserInteractedProject < ApplicationRecord
extend SuppressCompositePrimaryKeyWarning
belongs_to :user
belongs_to :project
......
# frozen_string_literal: true
class Analytics::LanguageTrend::RepositoryLanguage < ApplicationRecord
extend SuppressCompositePrimaryKeyWarning
belongs_to :programming_language
belongs_to :project
end
......@@ -2,4 +2,5 @@
# Model for join table between ApprovalProjectRule and ProtectedBranch
class ApprovalProjectRulesProtectedBranch < ApplicationRecord
extend SuppressCompositePrimaryKeyWarning
end
# frozen_string_literal: true
class UsersSecurityDashboardProject < ApplicationRecord
extend SuppressCompositePrimaryKeyWarning
SECURITY_DASHBOARD_PROJECTS_LIMIT = 1000
belongs_to :project
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment