Commit 7116c4ec authored by Nick Thomas's avatar Nick Thomas

Inherit from ApplicationRecord instead of ActiveRecord::Base

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