Commit fea9400e authored by Robert Speicher's avatar Robert Speicher

Merge branch 'add-pluck-primary-key' into 'master'

Add a thin encapsulation around .pluck(:id)

See merge request gitlab-org/gitlab-ce!26669
parents 36ecc88d f086dbf6
# frozen_string_literal: true # frozen_string_literal: true
class AbuseReport < ActiveRecord::Base class AbuseReport < ApplicationRecord
include CacheMarkdownField include CacheMarkdownField
cache_markdown_field :message, pipeline: :single_line cache_markdown_field :message, pipeline: :single_line
......
# frozen_string_literal: true # frozen_string_literal: true
class Appearance < ActiveRecord::Base class Appearance < ApplicationRecord
include CacheableAttributes include CacheableAttributes
include CacheMarkdownField include CacheMarkdownField
include ObjectStorage::BackgroundMove include ObjectStorage::BackgroundMove
......
...@@ -7,6 +7,14 @@ class ApplicationRecord < ActiveRecord::Base ...@@ -7,6 +7,14 @@ class ApplicationRecord < ActiveRecord::Base
where(id: ids) where(id: ids)
end end
def self.id_not_in(ids)
where.not(id: ids)
end
def self.pluck_primary_key
where(nil).pluck(self.primary_key)
end
def self.safe_find_or_create_by!(*args) def self.safe_find_or_create_by!(*args)
safe_find_or_create_by(*args).tap do |record| safe_find_or_create_by(*args).tap do |record|
record.validate! unless record.persisted? record.validate! unless record.persisted?
......
# frozen_string_literal: true # frozen_string_literal: true
class ApplicationSetting < ActiveRecord::Base class ApplicationSetting < ApplicationRecord
include CacheableAttributes include CacheableAttributes
include CacheMarkdownField include CacheMarkdownField
include TokenAuthenticatable include TokenAuthenticatable
......
# frozen_string_literal: true # frozen_string_literal: true
class ApplicationSetting class ApplicationSetting
class Term < ActiveRecord::Base class Term < ApplicationRecord
include CacheMarkdownField include CacheMarkdownField
has_many :term_agreements has_many :term_agreements
......
# frozen_string_literal: true # frozen_string_literal: true
class AuditEvent < ActiveRecord::Base class AuditEvent < ApplicationRecord
serialize :details, Hash # rubocop:disable Cop/ActiveRecordSerialize serialize :details, Hash # rubocop:disable Cop/ActiveRecordSerialize
belongs_to :user, foreign_key: :author_id belongs_to :user, foreign_key: :author_id
......
# frozen_string_literal: true # frozen_string_literal: true
class AwardEmoji < ActiveRecord::Base class AwardEmoji < ApplicationRecord
DOWNVOTE_NAME = "thumbsdown".freeze DOWNVOTE_NAME = "thumbsdown".freeze
UPVOTE_NAME = "thumbsup".freeze UPVOTE_NAME = "thumbsup".freeze
......
# frozen_string_literal: true # frozen_string_literal: true
class Badge < ActiveRecord::Base class Badge < ApplicationRecord
include FromUnion include FromUnion
# This structure sets the placeholders that the urls # This structure sets the placeholders that the urls
......
# frozen_string_literal: true # frozen_string_literal: true
class Board < ActiveRecord::Base class Board < ApplicationRecord
belongs_to :group belongs_to :group
belongs_to :project belongs_to :project
......
# frozen_string_literal: true # frozen_string_literal: true
# Tracks which boards in a specific group a user has visited # Tracks which boards in a specific group a user has visited
class BoardGroupRecentVisit < ActiveRecord::Base class BoardGroupRecentVisit < ApplicationRecord
belongs_to :user belongs_to :user
belongs_to :group belongs_to :group
belongs_to :board belongs_to :board
......
# frozen_string_literal: true # frozen_string_literal: true
# Tracks which boards in a specific project a user has visited # Tracks which boards in a specific project a user has visited
class BoardProjectRecentVisit < ActiveRecord::Base class BoardProjectRecentVisit < ApplicationRecord
belongs_to :user belongs_to :user
belongs_to :project belongs_to :project
belongs_to :board belongs_to :board
......
# frozen_string_literal: true # frozen_string_literal: true
class BroadcastMessage < ActiveRecord::Base class BroadcastMessage < ApplicationRecord
include CacheMarkdownField include CacheMarkdownField
include Sortable include Sortable
......
# frozen_string_literal: true # frozen_string_literal: true
class ChatName < ActiveRecord::Base class ChatName < ApplicationRecord
LAST_USED_AT_INTERVAL = 1.hour LAST_USED_AT_INTERVAL = 1.hour
belongs_to :service belongs_to :service
......
# frozen_string_literal: true # frozen_string_literal: true
class ChatTeam < ActiveRecord::Base class ChatTeam < ApplicationRecord
validates :team_id, presence: true validates :team_id, presence: true
validates :namespace, uniqueness: true validates :namespace, uniqueness: true
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Ci module Ci
# The purpose of this class is to store Build related data that can be disposed. # The purpose of this class is to store Build related data that can be disposed.
# Data that should be persisted forever, should be stored with Ci::Build model. # Data that should be persisted forever, should be stored with Ci::Build model.
class BuildMetadata < ActiveRecord::Base class BuildMetadata < ApplicationRecord
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
include Presentable include Presentable
include ChronicDurationAttribute include ChronicDurationAttribute
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Ci module Ci
# The purpose of this class is to store Build related runner session. # The purpose of this class is to store Build related runner session.
# Data will be removed after transitioning from running to any state. # Data will be removed after transitioning from running to any state.
class BuildRunnerSession < ActiveRecord::Base class BuildRunnerSession < ApplicationRecord
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
self.table_name = 'ci_builds_runner_session' self.table_name = 'ci_builds_runner_session'
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class BuildTraceChunk < ActiveRecord::Base class BuildTraceChunk < ApplicationRecord
include FastDestroyAll include FastDestroyAll
include ::Gitlab::ExclusiveLeaseHelpers include ::Gitlab::ExclusiveLeaseHelpers
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class BuildTraceSection < ActiveRecord::Base class BuildTraceSection < ApplicationRecord
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
belongs_to :build, class_name: 'Ci::Build' belongs_to :build, class_name: 'Ci::Build'
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class BuildTraceSectionName < ActiveRecord::Base class BuildTraceSectionName < ApplicationRecord
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
belongs_to :project belongs_to :project
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class GroupVariable < ActiveRecord::Base class GroupVariable < ApplicationRecord
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
include HasVariable include HasVariable
include Presentable include Presentable
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class JobArtifact < ActiveRecord::Base class JobArtifact < ApplicationRecord
include AfterCommitQueue include AfterCommitQueue
include ObjectStorage::BackgroundMove include ObjectStorage::BackgroundMove
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class Pipeline < ActiveRecord::Base class Pipeline < ApplicationRecord
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
include HasStatus include HasStatus
include Importable include Importable
...@@ -184,7 +184,7 @@ module Ci ...@@ -184,7 +184,7 @@ module Ci
scope :sort_by_merge_request_pipelines, -> do scope :sort_by_merge_request_pipelines, -> do
sql = 'CASE ci_pipelines.source WHEN (?) THEN 0 ELSE 1 END, ci_pipelines.id DESC' sql = 'CASE ci_pipelines.source WHEN (?) THEN 0 ELSE 1 END, ci_pipelines.id DESC'
query = ActiveRecord::Base.send(:sanitize_sql_array, [sql, sources[:merge_request_event]]) # rubocop:disable GitlabSecurity/PublicSend query = ApplicationRecord.send(:sanitize_sql_array, [sql, sources[:merge_request_event]]) # rubocop:disable GitlabSecurity/PublicSend
order(query) order(query)
end end
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class PipelineChatData < ActiveRecord::Base class PipelineChatData < ApplicationRecord
self.table_name = 'ci_pipeline_chat_data' self.table_name = 'ci_pipeline_chat_data'
belongs_to :chat_name belongs_to :chat_name
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class PipelineSchedule < ActiveRecord::Base class PipelineSchedule < ApplicationRecord
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
include Importable include Importable
include IgnorableColumn include IgnorableColumn
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class PipelineScheduleVariable < ActiveRecord::Base class PipelineScheduleVariable < ApplicationRecord
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
include HasVariable include HasVariable
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class PipelineVariable < ActiveRecord::Base class PipelineVariable < ApplicationRecord
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
include HasVariable include HasVariable
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class Runner < ActiveRecord::Base class Runner < ApplicationRecord
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
include Gitlab::SQL::Pattern include Gitlab::SQL::Pattern
include IgnorableColumn include IgnorableColumn
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class RunnerNamespace < ActiveRecord::Base class RunnerNamespace < ApplicationRecord
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
belongs_to :runner, inverse_of: :runner_namespaces, validate: true belongs_to :runner, inverse_of: :runner_namespaces, validate: true
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class RunnerProject < ActiveRecord::Base class RunnerProject < ApplicationRecord
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
belongs_to :runner, inverse_of: :runner_projects belongs_to :runner, inverse_of: :runner_projects
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class Stage < ActiveRecord::Base class Stage < ApplicationRecord
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
include Importable include Importable
include HasStatus include HasStatus
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class Trigger < ActiveRecord::Base class Trigger < ApplicationRecord
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
include IgnorableColumn include IgnorableColumn
include Presentable include Presentable
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class TriggerRequest < ActiveRecord::Base class TriggerRequest < ApplicationRecord
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
belongs_to :trigger belongs_to :trigger
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class Variable < ActiveRecord::Base class Variable < ApplicationRecord
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
include HasVariable include HasVariable
include Presentable include Presentable
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Clusters module Clusters
module Applications module Applications
class CertManager < ActiveRecord::Base class CertManager < ApplicationRecord
VERSION = 'v0.5.2'.freeze VERSION = 'v0.5.2'.freeze
self.table_name = 'clusters_applications_cert_managers' self.table_name = 'clusters_applications_cert_managers'
......
...@@ -4,7 +4,7 @@ require 'openssl' ...@@ -4,7 +4,7 @@ require 'openssl'
module Clusters module Clusters
module Applications module Applications
class Helm < ActiveRecord::Base class Helm < ApplicationRecord
self.table_name = 'clusters_applications_helm' self.table_name = 'clusters_applications_helm'
attr_encrypted :ca_key, attr_encrypted :ca_key,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Clusters module Clusters
module Applications module Applications
class Ingress < ActiveRecord::Base class Ingress < ApplicationRecord
VERSION = '1.1.2'.freeze VERSION = '1.1.2'.freeze
self.table_name = 'clusters_applications_ingress' self.table_name = 'clusters_applications_ingress'
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Clusters module Clusters
module Applications module Applications
class Jupyter < ActiveRecord::Base class Jupyter < ApplicationRecord
VERSION = '0.9-174bbd5'.freeze VERSION = '0.9-174bbd5'.freeze
self.table_name = 'clusters_applications_jupyter' self.table_name = 'clusters_applications_jupyter'
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Clusters module Clusters
module Applications module Applications
class Knative < ActiveRecord::Base class Knative < ApplicationRecord
VERSION = '0.3.0'.freeze VERSION = '0.3.0'.freeze
REPOSITORY = 'https://storage.googleapis.com/triggermesh-charts'.freeze REPOSITORY = 'https://storage.googleapis.com/triggermesh-charts'.freeze
METRICS_CONFIG = 'https://storage.googleapis.com/triggermesh-charts/istio-metrics.yaml'.freeze METRICS_CONFIG = 'https://storage.googleapis.com/triggermesh-charts/istio-metrics.yaml'.freeze
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Clusters module Clusters
module Applications module Applications
class Prometheus < ActiveRecord::Base class Prometheus < ApplicationRecord
include PrometheusAdapter include PrometheusAdapter
VERSION = '6.7.3' VERSION = '6.7.3'
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Clusters module Clusters
module Applications module Applications
class Runner < ActiveRecord::Base class Runner < ApplicationRecord
VERSION = '0.3.0'.freeze VERSION = '0.3.0'.freeze
self.table_name = 'clusters_applications_runners' self.table_name = 'clusters_applications_runners'
......
# frozen_string_literal: true # frozen_string_literal: true
module Clusters module Clusters
class Cluster < ActiveRecord::Base class Cluster < ApplicationRecord
include Presentable include Presentable
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
include FromUnion include FromUnion
......
# frozen_string_literal: true # frozen_string_literal: true
module Clusters module Clusters
class Group < ActiveRecord::Base class Group < ApplicationRecord
self.table_name = 'cluster_groups' self.table_name = 'cluster_groups'
belongs_to :cluster, class_name: 'Clusters::Cluster' belongs_to :cluster, class_name: 'Clusters::Cluster'
......
# frozen_string_literal: true # frozen_string_literal: true
module Clusters module Clusters
class KubernetesNamespace < ActiveRecord::Base class KubernetesNamespace < ApplicationRecord
include Gitlab::Kubernetes include Gitlab::Kubernetes
self.table_name = 'clusters_kubernetes_namespaces' self.table_name = 'clusters_kubernetes_namespaces'
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Clusters module Clusters
module Platforms module Platforms
class Kubernetes < ActiveRecord::Base class Kubernetes < ApplicationRecord
include Gitlab::Kubernetes include Gitlab::Kubernetes
include ReactiveCaching include ReactiveCaching
include EnumWithNil include EnumWithNil
......
# frozen_string_literal: true # frozen_string_literal: true
module Clusters module Clusters
class Project < ActiveRecord::Base class Project < ApplicationRecord
self.table_name = 'cluster_projects' self.table_name = 'cluster_projects'
belongs_to :cluster, class_name: 'Clusters::Cluster' belongs_to :cluster, class_name: 'Clusters::Cluster'
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Clusters module Clusters
module Providers module Providers
class Gcp < ActiveRecord::Base class Gcp < ApplicationRecord
self.table_name = 'cluster_providers_gcp' self.table_name = 'cluster_providers_gcp'
belongs_to :cluster, inverse_of: :provider_gcp, class_name: 'Clusters::Cluster' belongs_to :cluster, inverse_of: :provider_gcp, class_name: 'Clusters::Cluster'
......
# frozen_string_literal: true # frozen_string_literal: true
class CommitStatus < ActiveRecord::Base class CommitStatus < ApplicationRecord
include HasStatus include HasStatus
include Importable include Importable
include AfterCommitQueue include AfterCommitQueue
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# #
# For example, let's generate internal ids for Issue per Project: # For example, let's generate internal ids for Issue per Project:
# ``` # ```
# class Issue < ActiveRecord::Base # class Issue < ApplicationRecord
# has_internal_id :iid, scope: :project, init: ->(s) { s.project.issues.maximum(:iid) } # has_internal_id :iid, scope: :project, init: ->(s) { s.project.issues.maximum(:iid) }
# end # end
# ``` # ```
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# #
# Example: # Example:
# #
# class User < ActiveRecord::Base # class User < ApplicationRecord
# include IgnorableColumn # include IgnorableColumn
# #
# ignore_column :updated_at # ignore_column :updated_at
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# #
# Usage: # Usage:
# #
# class Issue < ActiveRecord::Base # class Issue < ApplicationRecord
# include Participable # include Participable
# #
# # ... # # ...
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# #
# Example of use: # Example of use:
# #
# class Foo < ActiveRecord::Base # class Foo < ApplicationRecord
# include ReactiveCaching # include ReactiveCaching
# #
# self.reactive_cache_key = ->(thing) { ["foo", thing.id] } # self.reactive_cache_key = ->(thing) { ["foo", thing.id] }
......
...@@ -39,7 +39,7 @@ module ShaAttribute ...@@ -39,7 +39,7 @@ module ShaAttribute
end end
def database_exists? def database_exists?
ActiveRecord::Base.connection ApplicationRecord.connection
true true
rescue rescue
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# #
# Usage: # Usage:
# #
# class Milestone < ActiveRecord::Base # class Milestone < ApplicationRecord
# strip_attributes :title # strip_attributes :title
# end # end
# #
......
# frozen_string_literal: true # frozen_string_literal: true
class ContainerRepository < ActiveRecord::Base class ContainerRepository < ApplicationRecord
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
belongs_to :project belongs_to :project
......
# frozen_string_literal: true # frozen_string_literal: true
module ConversationalDevelopmentIndex module ConversationalDevelopmentIndex
class Metric < ActiveRecord::Base class Metric < ApplicationRecord
include Presentable include Presentable
self.table_name = 'conversational_development_index_metrics' self.table_name = 'conversational_development_index_metrics'
......
# frozen_string_literal: true # frozen_string_literal: true
class DeployKeysProject < ActiveRecord::Base class DeployKeysProject < ApplicationRecord
belongs_to :project belongs_to :project
belongs_to :deploy_key, inverse_of: :deploy_keys_projects belongs_to :deploy_key, inverse_of: :deploy_keys_projects
......
# frozen_string_literal: true # frozen_string_literal: true
class DeployToken < ActiveRecord::Base class DeployToken < ApplicationRecord
include Expirable include Expirable
include TokenAuthenticatable include TokenAuthenticatable
include PolicyActor include PolicyActor
......
# frozen_string_literal: true # frozen_string_literal: true
class Deployment < ActiveRecord::Base class Deployment < ApplicationRecord
include AtomicInternalId include AtomicInternalId
include IidRoutes include IidRoutes
include AfterCommitQueue include AfterCommitQueue
......
# frozen_string_literal: true # frozen_string_literal: true
class Email < ActiveRecord::Base class Email < ApplicationRecord
include Sortable include Sortable
include Gitlab::SQL::Pattern include Gitlab::SQL::Pattern
......
# frozen_string_literal: true # frozen_string_literal: true
class Environment < ActiveRecord::Base class Environment < ApplicationRecord
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
# Used to generate random suffixes for the slug # Used to generate random suffixes for the slug
LETTERS = 'a'..'z' LETTERS = 'a'..'z'
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Placeholder class for model that is implemented in EE # Placeholder class for model that is implemented in EE
# It reserves '&' as a reference prefix, but the table does not exists in CE # It reserves '&' as a reference prefix, but the table does not exists in CE
class Epic < ActiveRecord::Base class Epic < ApplicationRecord
def self.link_reference_pattern def self.link_reference_pattern
nil nil
end end
......
# frozen_string_literal: true # frozen_string_literal: true
module ErrorTracking module ErrorTracking
class ProjectErrorTrackingSetting < ActiveRecord::Base class ProjectErrorTrackingSetting < ApplicationRecord
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
include ReactiveCaching include ReactiveCaching
......
# frozen_string_literal: true # frozen_string_literal: true
class Event < ActiveRecord::Base class Event < ApplicationRecord
include Sortable include Sortable
include IgnorableColumn include IgnorableColumn
include FromUnion include FromUnion
......
# frozen_string_literal: true # frozen_string_literal: true
class ForkNetwork < ActiveRecord::Base class ForkNetwork < ApplicationRecord
belongs_to :root_project, class_name: 'Project' belongs_to :root_project, class_name: 'Project'
has_many :fork_network_members has_many :fork_network_members
has_many :projects, through: :fork_network_members has_many :projects, through: :fork_network_members
......
# frozen_string_literal: true # frozen_string_literal: true
class ForkNetworkMember < ActiveRecord::Base class ForkNetworkMember < ApplicationRecord
belongs_to :fork_network belongs_to :fork_network
belongs_to :project belongs_to :project
belongs_to :forked_from_project, class_name: 'Project' belongs_to :forked_from_project, class_name: 'Project'
......
# frozen_string_literal: true # frozen_string_literal: true
class GpgKey < ActiveRecord::Base class GpgKey < ApplicationRecord
KEY_PREFIX = '-----BEGIN PGP PUBLIC KEY BLOCK-----'.freeze KEY_PREFIX = '-----BEGIN PGP PUBLIC KEY BLOCK-----'.freeze
KEY_SUFFIX = '-----END PGP PUBLIC KEY BLOCK-----'.freeze KEY_SUFFIX = '-----END PGP PUBLIC KEY BLOCK-----'.freeze
......
# frozen_string_literal: true # frozen_string_literal: true
class GpgKeySubkey < ActiveRecord::Base class GpgKeySubkey < ApplicationRecord
include ShaAttribute include ShaAttribute
sha_attribute :keyid sha_attribute :keyid
......
# frozen_string_literal: true # frozen_string_literal: true
class GroupCustomAttribute < ActiveRecord::Base class GroupCustomAttribute < ApplicationRecord
belongs_to :group belongs_to :group
validates :group, :key, :value, presence: true validates :group, :key, :value, presence: true
......
# frozen_string_literal: true # frozen_string_literal: true
class WebHook < ActiveRecord::Base class WebHook < ApplicationRecord
include Sortable include Sortable
attr_encrypted :token, attr_encrypted :token,
......
# frozen_string_literal: true # frozen_string_literal: true
class WebHookLog < ActiveRecord::Base class WebHookLog < ApplicationRecord
belongs_to :web_hook belongs_to :web_hook
serialize :request_headers, Hash # rubocop:disable Cop/ActiveRecordSerialize serialize :request_headers, Hash # rubocop:disable Cop/ActiveRecordSerialize
......
# frozen_string_literal: true # frozen_string_literal: true
class Identity < ActiveRecord::Base class Identity < ApplicationRecord
include Sortable include Sortable
include CaseSensitivity include CaseSensitivity
......
# frozen_string_literal: true # frozen_string_literal: true
class Identity < ActiveRecord::Base class Identity < ApplicationRecord
# This module and method are defined in a separate file to allow EE to # This module and method are defined in a separate file to allow EE to
# redefine the `scopes` method before it is used in the `Identity` model. # redefine the `scopes` method before it is used in the `Identity` model.
module UniquenessScopes module UniquenessScopes
......
# frozen_string_literal: true # frozen_string_literal: true
class ImportExportUpload < ActiveRecord::Base class ImportExportUpload < ApplicationRecord
include WithUploads include WithUploads
include ObjectStorage::BackgroundMove include ObjectStorage::BackgroundMove
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
# In order to leverage InternalId for other usages, the idea is to # In order to leverage InternalId for other usages, the idea is to
# * Add `usage` value to enum # * Add `usage` value to enum
# * (Optionally) add columns to `internal_ids` if needed for scope. # * (Optionally) add columns to `internal_ids` if needed for scope.
class InternalId < ActiveRecord::Base class InternalId < ApplicationRecord
belongs_to :project belongs_to :project
belongs_to :namespace belongs_to :namespace
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'carrierwave/orm/activerecord' require 'carrierwave/orm/activerecord'
class Issue < ActiveRecord::Base class Issue < ApplicationRecord
include AtomicInternalId include AtomicInternalId
include IidRoutes include IidRoutes
include Issuable include Issuable
......
# frozen_string_literal: true # frozen_string_literal: true
class Issue::Metrics < ActiveRecord::Base class Issue::Metrics < ApplicationRecord
belongs_to :issue belongs_to :issue
def record! def record!
......
# frozen_string_literal: true # frozen_string_literal: true
class IssueAssignee < ActiveRecord::Base class IssueAssignee < ApplicationRecord
belongs_to :issue belongs_to :issue
belongs_to :assignee, class_name: "User", foreign_key: :user_id belongs_to :assignee, class_name: "User", foreign_key: :user_id
end end
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'digest/md5' require 'digest/md5'
class Key < ActiveRecord::Base class Key < ApplicationRecord
include AfterCommitQueue include AfterCommitQueue
include Sortable include Sortable
......
# frozen_string_literal: true # frozen_string_literal: true
class Label < ActiveRecord::Base class Label < ApplicationRecord
include CacheMarkdownField include CacheMarkdownField
include Referable include Referable
include Subscribable include Subscribable
......
# frozen_string_literal: true # frozen_string_literal: true
class LabelLink < ActiveRecord::Base class LabelLink < ApplicationRecord
include Importable include Importable
belongs_to :target, polymorphic: true, inverse_of: :label_links # rubocop:disable Cop/PolymorphicAssociations belongs_to :target, polymorphic: true, inverse_of: :label_links # rubocop:disable Cop/PolymorphicAssociations
......
# frozen_string_literal: true # frozen_string_literal: true
class LabelPriority < ActiveRecord::Base class LabelPriority < ApplicationRecord
belongs_to :project belongs_to :project
belongs_to :label belongs_to :label
......
# frozen_string_literal: true # frozen_string_literal: true
class LfsFileLock < ActiveRecord::Base class LfsFileLock < ApplicationRecord
belongs_to :project belongs_to :project
belongs_to :user belongs_to :user
......
# frozen_string_literal: true # frozen_string_literal: true
class LfsObject < ActiveRecord::Base class LfsObject < ApplicationRecord
include AfterCommitQueue include AfterCommitQueue
include ObjectStorage::BackgroundMove include ObjectStorage::BackgroundMove
......
# frozen_string_literal: true # frozen_string_literal: true
class LfsObjectsProject < ActiveRecord::Base class LfsObjectsProject < ApplicationRecord
belongs_to :project belongs_to :project
belongs_to :lfs_object belongs_to :lfs_object
......
# frozen_string_literal: true # frozen_string_literal: true
class List < ActiveRecord::Base class List < ApplicationRecord
belongs_to :board belongs_to :board
belongs_to :label belongs_to :label
......
# frozen_string_literal: true # frozen_string_literal: true
class Member < ActiveRecord::Base class Member < ApplicationRecord
include AfterCommitQueue include AfterCommitQueue
include Sortable include Sortable
include Importable include Importable
......
# frozen_string_literal: true # frozen_string_literal: true
class MergeRequest < ActiveRecord::Base class MergeRequest < ApplicationRecord
include AtomicInternalId include AtomicInternalId
include IidRoutes include IidRoutes
include Issuable include Issuable
......
# frozen_string_literal: true # frozen_string_literal: true
class MergeRequest::Metrics < ActiveRecord::Base class MergeRequest::Metrics < ApplicationRecord
belongs_to :merge_request belongs_to :merge_request
belongs_to :pipeline, class_name: 'Ci::Pipeline', foreign_key: :pipeline_id belongs_to :pipeline, class_name: 'Ci::Pipeline', foreign_key: :pipeline_id
belongs_to :latest_closed_by, class_name: 'User' belongs_to :latest_closed_by, class_name: 'User'
......
# frozen_string_literal: true # frozen_string_literal: true
class MergeRequestDiff < ActiveRecord::Base class MergeRequestDiff < ApplicationRecord
include Sortable include Sortable
include Importable include Importable
include ManualInverseAssociation include ManualInverseAssociation
......
# frozen_string_literal: true # frozen_string_literal: true
class MergeRequestDiffCommit < ActiveRecord::Base class MergeRequestDiffCommit < ApplicationRecord
include ShaAttribute include ShaAttribute
belongs_to :merge_request_diff belongs_to :merge_request_diff
......
# frozen_string_literal: true # frozen_string_literal: true
class MergeRequestDiffFile < ActiveRecord::Base class MergeRequestDiffFile < ApplicationRecord
include Gitlab::EncodingHelper include Gitlab::EncodingHelper
include DiffFile include DiffFile
......
# frozen_string_literal: true # frozen_string_literal: true
class MergeRequestsClosingIssues < ActiveRecord::Base class MergeRequestsClosingIssues < ApplicationRecord
belongs_to :merge_request belongs_to :merge_request
belongs_to :issue belongs_to :issue
......
# frozen_string_literal: true # frozen_string_literal: true
class Milestone < ActiveRecord::Base class Milestone < ApplicationRecord
# Represents a "No Milestone" state used for filtering Issues and Merge # Represents a "No Milestone" state used for filtering Issues and Merge
# Requests that have no milestone assigned. # Requests that have no milestone assigned.
MilestoneStruct = Struct.new(:title, :name, :id) MilestoneStruct = Struct.new(:title, :name, :id)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# A note on the root of an issue, merge request, commit, or snippet. # A note on the root of an issue, merge request, commit, or snippet.
# #
# A note of this type is never resolvable. # A note of this type is never resolvable.
class Note < ActiveRecord::Base class Note < ApplicationRecord
extend ActiveModel::Naming extend ActiveModel::Naming
include Participable include Participable
include Mentionable include Mentionable
......
# frozen_string_literal: true # frozen_string_literal: true
class NoteDiffFile < ActiveRecord::Base class NoteDiffFile < ApplicationRecord
include DiffFile include DiffFile
scope :for_commit_or_unresolved, -> do scope :for_commit_or_unresolved, -> do
......
# frozen_string_literal: true # frozen_string_literal: true
class NotificationSetting < ActiveRecord::Base class NotificationSetting < ApplicationRecord
include IgnorableColumn include IgnorableColumn
ignore_column :events ignore_column :events
......
# frozen_string_literal: true # frozen_string_literal: true
class PagesDomain < ActiveRecord::Base class PagesDomain < ApplicationRecord
VERIFICATION_KEY = 'gitlab-pages-verification-code'.freeze VERIFICATION_KEY = 'gitlab-pages-verification-code'.freeze
VERIFICATION_THRESHOLD = 3.days.freeze VERIFICATION_THRESHOLD = 3.days.freeze
......
# frozen_string_literal: true # frozen_string_literal: true
class PersonalAccessToken < ActiveRecord::Base class PersonalAccessToken < ApplicationRecord
include Expirable include Expirable
include IgnorableColumn include IgnorableColumn
include TokenAuthenticatable include TokenAuthenticatable
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# The PoolRepository model is the database equivalent of an ObjectPool for Gitaly # The PoolRepository model is the database equivalent of an ObjectPool for Gitaly
# That is; PoolRepository is the record in the database, ObjectPool is the # That is; PoolRepository is the record in the database, ObjectPool is the
# repository on disk # repository on disk
class PoolRepository < ActiveRecord::Base class PoolRepository < ApplicationRecord
include Shardable include Shardable
include AfterCommitQueue include AfterCommitQueue
......
# frozen_string_literal: true # frozen_string_literal: true
module Postgresql module Postgresql
class ReplicationSlot < ActiveRecord::Base class ReplicationSlot < ApplicationRecord
self.table_name = 'pg_replication_slots' self.table_name = 'pg_replication_slots'
# Returns true if there are any replication slots in use. # Returns true if there are any replication slots in use.
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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