Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
aaeaab23bf
commit
8b88def0da
|
|
@ -1,110 +0,0 @@
|
|||
---
|
||||
# Cop supports --autocorrect.
|
||||
Rails/EnumSyntax:
|
||||
Exclude:
|
||||
- 'app/models/abuse_report.rb'
|
||||
- 'app/models/alert_management/alert.rb'
|
||||
- 'app/models/alert_management/http_integration.rb'
|
||||
- 'app/models/analytics/cycle_analytics/issue_stage_event.rb'
|
||||
- 'app/models/analytics/cycle_analytics/merge_request_stage_event.rb'
|
||||
- 'app/models/analytics/usage_trends/measurement.rb'
|
||||
- 'app/models/anti_abuse/event.rb'
|
||||
- 'app/models/anti_abuse/trust_score.rb'
|
||||
- 'app/models/application_record.rb'
|
||||
- 'app/models/authentication_event.rb'
|
||||
- 'app/models/batched_git_ref_updates/deletion.rb'
|
||||
- 'app/models/bulk_import.rb'
|
||||
- 'app/models/bulk_imports/entity.rb'
|
||||
- 'app/models/ci/build_metadata.rb'
|
||||
- 'app/models/ci/build_pending_state.rb'
|
||||
- 'app/models/ci/build_source.rb'
|
||||
- 'app/models/ci/build_trace_chunk.rb'
|
||||
- 'app/models/ci/catalog/resource.rb'
|
||||
- 'app/models/ci/catalog/resources/component.rb'
|
||||
- 'app/models/ci/catalog/resources/sync_event.rb'
|
||||
- 'app/models/ci/catalog/verified_namespace.rb'
|
||||
- 'app/models/ci/external_pull_request.rb'
|
||||
- 'app/models/ci/job_artifact.rb'
|
||||
- 'app/models/ci/job_token/project_scope_link.rb'
|
||||
- 'app/models/ci/job_variable.rb'
|
||||
- 'app/models/ci/pipeline.rb'
|
||||
- 'app/models/ci/pipeline_artifact.rb'
|
||||
- 'app/models/ci/pipeline_message.rb'
|
||||
- 'app/models/ci/pipeline_metadata.rb'
|
||||
- 'app/models/ci/resource_group.rb'
|
||||
- 'app/models/ci/runner.rb'
|
||||
- 'app/models/ci/runner_manager.rb'
|
||||
- 'app/models/ci/runner_version.rb'
|
||||
- 'app/models/ci/running_build.rb'
|
||||
- 'app/models/ci/stage.rb'
|
||||
- 'app/models/clusters/agent_token.rb'
|
||||
- 'app/models/clusters/agents/activity_event.rb'
|
||||
- 'app/models/clusters/cluster.rb'
|
||||
- 'app/models/clusters/integrations/prometheus.rb'
|
||||
- 'app/models/clusters/platforms/kubernetes.rb'
|
||||
- 'app/models/commit_status.rb'
|
||||
- 'app/models/concerns/analytics/cycle_analytics/stageable.rb'
|
||||
- 'app/models/concerns/ci/artifactable.rb'
|
||||
- 'app/models/concerns/ci/has_runner_executor.rb'
|
||||
- 'app/models/concerns/ci/has_variable.rb'
|
||||
- 'app/models/concerns/ci/lockable.rb'
|
||||
- 'app/models/concerns/commit_signature.rb'
|
||||
- 'app/models/concerns/has_user_type.rb'
|
||||
- 'app/models/concerns/import/has_import_source.rb'
|
||||
- 'app/models/concerns/issuable_link.rb'
|
||||
- 'app/models/concerns/merge_request_reviewer_state.rb'
|
||||
- 'app/models/concerns/packages/debian/component_file.rb'
|
||||
- 'app/models/concerns/ttl_expirable.rb'
|
||||
- 'app/models/container_registry/data_repair_detail.rb'
|
||||
- 'app/models/container_registry/protection/rule.rb'
|
||||
- 'app/models/container_repository.rb'
|
||||
- 'app/models/customer_relations/contact.rb'
|
||||
- 'app/models/customer_relations/organization.rb'
|
||||
- 'app/models/deploy_token.rb'
|
||||
- 'app/models/deployment.rb'
|
||||
- 'app/models/design_management/action.rb'
|
||||
- 'app/models/diff_note_position.rb'
|
||||
- 'app/models/draft_note.rb'
|
||||
- 'app/models/environment.rb'
|
||||
- 'app/models/error_tracking/error.rb'
|
||||
- 'app/models/event.rb'
|
||||
- 'app/models/integrations/jira.rb'
|
||||
- 'app/models/integrations/jira_tracker_data.rb'
|
||||
- 'app/models/internal_id.rb'
|
||||
- 'app/models/issuable_severity.rb'
|
||||
- 'app/models/jira_import_state.rb'
|
||||
- 'app/models/key.rb'
|
||||
- 'app/models/list.rb'
|
||||
- 'app/models/loose_foreign_keys/deleted_record.rb'
|
||||
- 'app/models/merge_request_diff.rb'
|
||||
- 'app/models/ml/candidate.rb'
|
||||
- 'app/models/namespace/root_storage_statistics.rb'
|
||||
- 'app/models/namespace_setting.rb'
|
||||
- 'app/models/notification_setting.rb'
|
||||
- 'app/models/operations/feature_flag.rb'
|
||||
- 'app/models/organizations/organization_user.rb'
|
||||
- 'app/models/packages/conan/file_metadatum.rb'
|
||||
- 'app/models/packages/debian/file_metadatum.rb'
|
||||
- 'app/models/packages/dependency_link.rb'
|
||||
- 'app/models/packages/npm/metadata_cache.rb'
|
||||
- 'app/models/packages/package.rb'
|
||||
- 'app/models/packages/package_file.rb'
|
||||
- 'app/models/packages/protection/rule.rb'
|
||||
- 'app/models/packages/rpm/repository_file.rb'
|
||||
- 'app/models/pages_domain.rb'
|
||||
- 'app/models/project.rb'
|
||||
- 'app/models/project_auto_devops.rb'
|
||||
- 'app/models/project_ci_cd_setting.rb'
|
||||
- 'app/models/project_repository.rb'
|
||||
- 'app/models/projects/ci_feature_usage.rb'
|
||||
- 'app/models/push_event_payload.rb'
|
||||
- 'app/models/releases/link.rb'
|
||||
- 'app/models/resource_events/abuse_report_event.rb'
|
||||
- 'app/models/resource_events/issue_assignment_event.rb'
|
||||
- 'app/models/resource_events/merge_request_assignment_event.rb'
|
||||
- 'app/models/resource_label_event.rb'
|
||||
- 'app/models/resource_milestone_event.rb'
|
||||
- 'app/models/resource_state_event.rb'
|
||||
- 'app/models/resource_timebox_event.rb'
|
||||
- 'app/models/service_desk/custom_email_credential.rb'
|
||||
- 'app/models/service_desk/custom_email_verification.rb'
|
||||
|
|
@ -1 +1 @@
|
|||
124a10130bac885023b44616e773ffd4229ee592
|
||||
c46abdc81b87926a9cc99e13fdcbfb8ec516cb17
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ export default {
|
|||
:style="floatingWrapperStyles"
|
||||
>
|
||||
<panel-resizer
|
||||
class="diff-tree-list-resizer"
|
||||
class="diff-tree-list-resizer gl-hidden lg:gl-block"
|
||||
:start-size="treeWidth"
|
||||
:min-size="$options.minTreeWidth"
|
||||
:max-size="$options.maxTreeWidth"
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ export default {
|
|||
},
|
||||
},
|
||||
data() {
|
||||
const isClickHouseAvailable =
|
||||
this.clickHouseEnabledForAnalytics && this.glFeatures?.ciImprovedProjectPipelineAnalytics;
|
||||
const isClickHouseAvailable = this.clickHouseEnabledForAnalytics;
|
||||
|
||||
const tabs = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export default {
|
|||
};
|
||||
</script>
|
||||
<template>
|
||||
<help-popover v-if="glFeatures.ciImprovedProjectPipelineAnalytics">
|
||||
<help-popover>
|
||||
<template #title>
|
||||
{{ s__('PipelineCharts|Try ClickHouse for advanced analytics') }}
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ export default {
|
|||
},
|
||||
searchInputDelay: 250,
|
||||
wildcardsHelpPath: helpPagePath('user/project/repository/branches/protected', {
|
||||
anchor: 'protect-multiple-branches-with-wildcard-rules',
|
||||
anchor: 'use-wildcard-rules',
|
||||
}),
|
||||
props: {
|
||||
projectPath: {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { s__ } from '~/locale';
|
|||
import getProtectableBranches from '../graphql/queries/protectable_branches.query.graphql';
|
||||
|
||||
const wildcardsHelpDocLink = helpPagePath('user/project/repository/branches/protected', {
|
||||
anchor: 'protect-multiple-branches-with-wildcard-rules',
|
||||
anchor: 'use-wildcard-rules',
|
||||
});
|
||||
export default {
|
||||
name: 'BranchRuleModal',
|
||||
|
|
|
|||
|
|
@ -153,34 +153,18 @@ class GroupsController < Groups::ApplicationController
|
|||
def merge_requests; end
|
||||
|
||||
def update
|
||||
update_result = Groups::UpdateService.new(@group, current_user, group_params).execute
|
||||
if Groups::UpdateService.new(@group, current_user, group_params).execute
|
||||
|
||||
respond_to do |format|
|
||||
if update_result
|
||||
format.html do
|
||||
if @group.namespace_settings.errors.present?
|
||||
flash[:alert] = @group.namespace_settings.errors.full_messages.to_sentence
|
||||
else
|
||||
flash[:notice] = "Group '#{@group.name}' was successfully updated."
|
||||
end
|
||||
|
||||
redirect_to edit_group_origin_location
|
||||
end
|
||||
|
||||
format.json do
|
||||
head :no_content
|
||||
end
|
||||
if @group.namespace_settings.errors.present?
|
||||
flash[:alert] = group.namespace_settings.errors.full_messages.to_sentence
|
||||
else
|
||||
format.html do
|
||||
@group.reset
|
||||
|
||||
render action: 'edit'
|
||||
end
|
||||
|
||||
format.json do
|
||||
render json: {}, status: :unprocessable_entity
|
||||
end
|
||||
flash[:notice] = "Group '#{@group.name}' was successfully updated."
|
||||
end
|
||||
|
||||
redirect_to edit_group_origin_location
|
||||
else
|
||||
@group.reset
|
||||
render action: "edit"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -150,7 +150,8 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap
|
|||
end
|
||||
|
||||
def rapid_diffs?
|
||||
::Feature.enabled?(:rapid_diffs, current_user, type: :wip) &&
|
||||
params[:rapid_diffs_disabled] != 'true' &&
|
||||
::Feature.enabled?(:rapid_diffs, current_user, type: :wip) &&
|
||||
::Feature.enabled?(:rapid_diffs_on_mr_creation, current_user, type: :wip)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -11,10 +11,6 @@ class Projects::PipelinesController < Projects::ApplicationController
|
|||
:charts, :destroy, :status, :manual_variables
|
||||
]
|
||||
|
||||
before_action only: [:charts] do
|
||||
push_frontend_feature_flag(:ci_improved_project_pipeline_analytics, project)
|
||||
end
|
||||
|
||||
before_action only: [:show] do
|
||||
push_frontend_feature_flag(:ci_pipeline_status_realtime, project)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class AbuseReport < ApplicationRecord
|
|||
scope :with_users, -> { includes(:reporter, :user) }
|
||||
scope :with_labels, -> { includes(:labels) }
|
||||
|
||||
enum category: {
|
||||
enum :category, {
|
||||
spam: 1,
|
||||
offensive: 2,
|
||||
phishing: 3,
|
||||
|
|
@ -93,7 +93,7 @@ class AbuseReport < ApplicationRecord
|
|||
other: 8
|
||||
}
|
||||
|
||||
enum status: {
|
||||
enum :status, {
|
||||
open: 1,
|
||||
closed: 2
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ module AlertManagement
|
|||
}, unless: :resolved?
|
||||
validate :hosts_format
|
||||
|
||||
enum severity: {
|
||||
enum :severity, {
|
||||
critical: 0,
|
||||
high: 1,
|
||||
medium: 2,
|
||||
|
|
@ -69,7 +69,7 @@ module AlertManagement
|
|||
unknown: 5
|
||||
}
|
||||
|
||||
enum domain: {
|
||||
enum :domain, {
|
||||
operations: 0,
|
||||
threat_monitoring: 1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ module AlertManagement
|
|||
scope :active, -> { where(active: true) }
|
||||
scope :ordered_by_type_and_id, -> { order(:type_identifier, :id) }
|
||||
|
||||
enum type_identifier: {
|
||||
enum :type_identifier, {
|
||||
http: 0,
|
||||
prometheus: 1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ module Analytics
|
|||
validates(*%i[stage_event_hash_id issue_id group_id project_id start_event_timestamp], presence: true)
|
||||
|
||||
alias_attribute :state, :state_id
|
||||
enum state: Issue.available_states, _suffix: true
|
||||
enum :state, Issue.available_states, suffix: true
|
||||
belongs_to :issuable, class_name: 'Issue', foreign_key: 'issue_id', inverse_of: :issue_stage_events
|
||||
|
||||
scope :assigned_to, ->(user) do
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ module Analytics
|
|||
validates(*%i[stage_event_hash_id merge_request_id group_id project_id start_event_timestamp], presence: true)
|
||||
|
||||
alias_attribute :state, :state_id
|
||||
enum state: MergeRequest.available_states, _suffix: true
|
||||
enum :state, MergeRequest.available_states, suffix: true
|
||||
|
||||
belongs_to :issuable, class_name: 'MergeRequest', foreign_key: 'merge_request_id', inverse_of: :merge_request_stage_events
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ module Analytics
|
|||
class Measurement < ApplicationRecord
|
||||
self.table_name = 'analytics_usage_trends_measurements'
|
||||
|
||||
enum identifier: {
|
||||
enum :identifier, {
|
||||
projects: 1,
|
||||
users: 2,
|
||||
issues: 3,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module AntiAbuse
|
|||
belongs_to :user, inverse_of: :abuse_events
|
||||
belongs_to :abuse_report, inverse_of: :abuse_events
|
||||
|
||||
enum category: Enums::Abuse::Category.categories
|
||||
enum source: Enums::Abuse::Source.sources
|
||||
enum :category, Enums::Abuse::Category.categories
|
||||
enum :source, Enums::Abuse::Source.sources
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ module AntiAbuse
|
|||
class TrustScore < ApplicationRecord
|
||||
self.table_name = 'abuse_trust_scores'
|
||||
|
||||
enum source: Enums::Abuse::Source.sources
|
||||
enum :source, Enums::Abuse::Source.sources
|
||||
|
||||
belongs_to :user
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ class ApplicationRecord < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def self.declarative_enum(enum_mod)
|
||||
enum(enum_mod.key => enum_mod.values)
|
||||
enum enum_mod.key, enum_mod.values
|
||||
end
|
||||
|
||||
def self.cached_column_list
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class AuthenticationEvent < ApplicationRecord
|
|||
validates :provider, :user_name, :result, presence: true
|
||||
validates :ip_address, ip_address: true
|
||||
|
||||
enum result: {
|
||||
enum :result, {
|
||||
failed: 0,
|
||||
success: 1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ module BatchedGitRefUpdates
|
|||
.exists?
|
||||
end
|
||||
|
||||
enum status: { pending: 1, processed: 2 }, _prefix: :status
|
||||
enum :status, { pending: 1, processed: 2 }, prefix: :status
|
||||
|
||||
def self.mark_records_processed(records)
|
||||
update_by_partition(records) do |partitioned_scope|
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class BulkImport < ApplicationRecord
|
|||
|
||||
validates :source_type, :status, presence: true
|
||||
|
||||
enum source_type: { gitlab: 0 }
|
||||
enum :source_type, { gitlab: 0 }
|
||||
|
||||
scope :stale, -> { where('updated_at < ?', 24.hours.ago).where(status: [0, 1]) }
|
||||
scope :order_by_updated_at_and_id, ->(direction) { order(updated_at: direction, id: :asc) }
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class BulkImports::Entity < ApplicationRecord
|
|||
validate :validate_source_full_path_format
|
||||
validate :validate_bulk_import_organization_matches
|
||||
|
||||
enum source_type: { group_entity: 0, project_entity: 1 }
|
||||
enum :source_type, { group_entity: 0, project_entity: 1 }
|
||||
|
||||
scope :by_user_id, ->(user_id) { joins(:bulk_import).where(bulk_imports: { user_id: user_id }) }
|
||||
scope :stale, -> { where('updated_at < ?', 24.hours.ago).where(status: [0, 1]) }
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ module Ci
|
|||
scope :with_interruptible, -> { where(interruptible: true) }
|
||||
scope :with_exposed_artifacts, -> { where(has_exposed_artifacts: true) }
|
||||
|
||||
enum timeout_source: {
|
||||
enum :timeout_source, {
|
||||
unknown_timeout_source: 1,
|
||||
project_timeout_source: 2,
|
||||
runner_timeout_source: 3,
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ class Ci::BuildPendingState < Ci::ApplicationRecord
|
|||
|
||||
partitionable scope: :build
|
||||
|
||||
enum state: Ci::Stage.statuses
|
||||
enum failure_reason: CommitStatus.failure_reasons
|
||||
enum :state, Ci::Stage.statuses
|
||||
enum :failure_reason, CommitStatus.failure_reasons
|
||||
|
||||
validates :build, presence: true
|
||||
validates :project_id, presence: true, on: :create
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ module Ci
|
|||
|
||||
ignore_column :pipeline_source, remove_with: '17.9', remove_after: '2025-01-15'
|
||||
|
||||
enum source: {
|
||||
enum :source, {
|
||||
scan_execution_policy: 1001,
|
||||
pipeline_execution_policy: 1002
|
||||
}.merge(::Enums::Ci::Pipeline.sources)
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ module Ci
|
|||
end.freeze
|
||||
LIVE_STORES = %i[redis redis_trace_chunks].freeze
|
||||
|
||||
enum data_store: DATA_STORES
|
||||
enum :data_store, DATA_STORES
|
||||
|
||||
scope :live, -> { where(data_store: LIVE_STORES) }
|
||||
scope :persisted, -> { where.not(data_store: LIVE_STORES).order(:chunk_index) }
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ module Ci
|
|||
has_many :component_last_usages, class_name: 'Ci::Catalog::Resources::Components::LastUsage',
|
||||
foreign_key: :catalog_resource_id, inverse_of: :catalog_resource
|
||||
|
||||
enum verification_level: VerifiedNamespace::VERIFICATION_LEVELS
|
||||
enum :verification_level, VerifiedNamespace::VERIFICATION_LEVELS
|
||||
|
||||
scope :for_projects, ->(project_ids) { where(project_id: project_ids) }
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ module Ci
|
|||
|
||||
delegate :avatar_path, :star_count, :full_path, to: :project
|
||||
|
||||
enum state: { unpublished: 0, published: 1 }
|
||||
enum :state, { unpublished: 0, published: 1 }
|
||||
|
||||
before_create :sync_with_project
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ module Ci
|
|||
# an error about the save callback that is auto generated for this association.
|
||||
include BulkInsertSafe
|
||||
|
||||
enum component_type: { template: 1 }
|
||||
enum :component_type, { template: 1 }
|
||||
|
||||
validates :spec, json_schema: { filename: 'catalog_resource_component_spec' }
|
||||
validates :version, :catalog_resource, :project, :name, presence: true
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ module Ci
|
|||
scope :unprocessed_events, -> { select_with_partition.status_pending }
|
||||
scope :preload_synced_relation, -> { preload(catalog_resource: :project) }
|
||||
|
||||
enum status: { pending: 1, processed: 2 }, _prefix: :status
|
||||
enum :status, { pending: 1, processed: 2 }, prefix: :status
|
||||
|
||||
partitioned_by :partition_id, strategy: :sliding_list,
|
||||
next_partition_if: ->(active_partition) do
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ module Ci
|
|||
|
||||
belongs_to :namespace
|
||||
|
||||
enum verification_level: VERIFICATION_LEVELS
|
||||
enum :verification_level, VERIFICATION_LEVELS
|
||||
|
||||
validates :namespace_id, presence: true, uniqueness: true
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ module Ci
|
|||
validates :target_repository, presence: true
|
||||
validates :status, presence: true
|
||||
|
||||
enum status: {
|
||||
enum :status, {
|
||||
open: 1,
|
||||
closed: 2
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ module Ci
|
|||
partitionable scope: :job, partitioned: true
|
||||
query_constraints :id, :partition_id
|
||||
|
||||
enum accessibility: { public: 0, private: 1, none: 2 }, _suffix: true
|
||||
enum :accessibility, { public: 0, private: 1, none: 2 }, suffix: true
|
||||
|
||||
belongs_to :project
|
||||
belongs_to :job,
|
||||
|
|
@ -96,7 +96,7 @@ module Ci
|
|||
scope :created_in_time_range, ->(from: nil, to: nil) { where(created_at: from..to) }
|
||||
|
||||
delegate :filename, :exists?, :open, to: :file
|
||||
enum file_type: Enums::Ci::JobArtifact.file_type
|
||||
enum :file_type, Enums::Ci::JobArtifact.file_type
|
||||
|
||||
# `file_location` indicates where actual files are stored.
|
||||
# Ideally, actual files should be stored in the same directory, and use the same
|
||||
|
|
@ -107,7 +107,7 @@ module Ci
|
|||
# `ci_builds.artifacts_file` and `ci_builds.artifacts_metadata`
|
||||
# hashed_path ... The actual file is stored at a path consists of a SHA2 based on the project ID.
|
||||
# This is the default value.
|
||||
enum file_location: Enums::Ci::JobArtifact.file_location
|
||||
enum :file_location, Enums::Ci::JobArtifact.file_location
|
||||
|
||||
def validate_file_format!
|
||||
unless Enums::Ci::JobArtifact.type_and_format_pairs[self.file_type&.to_sym] == self.file_format&.to_sym
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ module Ci
|
|||
|
||||
# When outbound the target project is allowed to be accessed by the source job token.
|
||||
# When inbound the source project is allowed to be accessed by the target job token.
|
||||
enum direction: {
|
||||
enum :direction, {
|
||||
outbound: 0,
|
||||
inbound: 1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ module Ci
|
|||
validates :key, uniqueness: { scope: :job_id }, unless: :dotenv_source?
|
||||
validates :project_id, presence: true, on: :create
|
||||
|
||||
enum source: { internal: 0, dotenv: 1 }, _suffix: true
|
||||
enum :source, { internal: 0, dotenv: 1 }, suffix: true
|
||||
|
||||
def set_project_id
|
||||
self.project_id ||= job&.project_id
|
||||
|
|
|
|||
|
|
@ -197,15 +197,15 @@ module Ci
|
|||
|
||||
# We use `Enums::Ci::Pipeline.sources` here so that EE can more easily extend
|
||||
# this `Hash` with new values.
|
||||
enum source: Enums::Ci::Pipeline.sources
|
||||
enum :source, Enums::Ci::Pipeline.sources
|
||||
|
||||
enum config_source: Enums::Ci::Pipeline.config_sources
|
||||
enum :config_source, Enums::Ci::Pipeline.config_sources
|
||||
|
||||
# We use `Enums::Ci::Pipeline.failure_reasons` here so that EE can more easily
|
||||
# extend this `Hash` with new values.
|
||||
enum failure_reason: Enums::Ci::Pipeline.failure_reasons
|
||||
enum :failure_reason, Enums::Ci::Pipeline.failure_reasons
|
||||
|
||||
enum locked: { unlocked: 0, artifacts_locked: 1 }
|
||||
enum :locked, { unlocked: 0, artifacts_locked: 1 }
|
||||
|
||||
state_machine :status, initial: :created do
|
||||
event :enqueue do
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ module Ci
|
|||
|
||||
update_project_statistics project_statistics_name: :pipeline_artifacts_size
|
||||
|
||||
enum file_type: {
|
||||
enum :file_type, {
|
||||
code_coverage: 1,
|
||||
code_quality_mr_diff: 2
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ module Ci
|
|||
|
||||
before_save :truncate_long_content
|
||||
|
||||
enum severity: { error: 0, warning: 1 }
|
||||
enum :severity, { error: 0, warning: 1 }
|
||||
|
||||
private
|
||||
|
||||
|
|
|
|||
|
|
@ -7,16 +7,16 @@ module Ci
|
|||
|
||||
self.primary_key = :pipeline_id
|
||||
|
||||
enum auto_cancel_on_new_commit: {
|
||||
enum :auto_cancel_on_new_commit, {
|
||||
conservative: 0,
|
||||
interruptible: 1,
|
||||
none: 2
|
||||
}, _prefix: true
|
||||
}, prefix: true
|
||||
|
||||
enum auto_cancel_on_job_failure: {
|
||||
enum :auto_cancel_on_job_failure, {
|
||||
none: 0,
|
||||
all: 1
|
||||
}, _prefix: true
|
||||
}, prefix: true
|
||||
|
||||
belongs_to :pipeline, class_name: "Ci::Pipeline", inverse_of: :pipeline_metadata
|
||||
belongs_to :project, class_name: "Project", inverse_of: :pipeline_metadata
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ module Ci
|
|||
|
||||
before_create :ensure_resource
|
||||
|
||||
enum process_mode: {
|
||||
enum :process_mode, {
|
||||
unordered: 0,
|
||||
oldest_first: 1,
|
||||
newest_first: 2,
|
||||
|
|
|
|||
|
|
@ -35,26 +35,26 @@ module Ci
|
|||
}
|
||||
}
|
||||
|
||||
enum access_level: {
|
||||
enum :access_level, {
|
||||
not_protected: 0,
|
||||
ref_protected: 1
|
||||
}
|
||||
|
||||
enum runner_type: {
|
||||
enum :runner_type, {
|
||||
instance_type: 1,
|
||||
group_type: 2,
|
||||
project_type: 3
|
||||
}
|
||||
|
||||
enum creation_state: {
|
||||
enum :creation_state, {
|
||||
started: 0,
|
||||
finished: 100
|
||||
}, _suffix: true
|
||||
}, suffix: true
|
||||
|
||||
enum registration_type: {
|
||||
enum :registration_type, {
|
||||
registration_token: 0,
|
||||
authenticated_user: 1
|
||||
}, _suffix: true
|
||||
}, suffix: true
|
||||
|
||||
# Prefix assigned to runners created from the UI, instead of registered via the command line
|
||||
CREATED_RUNNER_TOKEN_PREFIX = 'glrt-'
|
||||
|
|
|
|||
|
|
@ -39,12 +39,12 @@ module Ci
|
|||
|
||||
belongs_to :runner, class_name: 'Ci::Runner', inverse_of: :runner_managers
|
||||
|
||||
enum creation_state: {
|
||||
enum :creation_state, {
|
||||
started: 0,
|
||||
finished: 100
|
||||
}, _suffix: true
|
||||
}, suffix: true
|
||||
|
||||
enum runner_type: Runner.runner_types
|
||||
enum :runner_type, Runner.runner_types
|
||||
|
||||
has_many :runner_manager_builds, inverse_of: :runner_manager, foreign_key: :runner_machine_id,
|
||||
class_name: 'Ci::RunnerManagerBuild'
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ module Ci
|
|||
class RunnerVersion < Ci::ApplicationRecord
|
||||
include EachBatch
|
||||
|
||||
enum status: {
|
||||
enum :status, {
|
||||
not_processed: nil,
|
||||
invalid_version: -1,
|
||||
unavailable: 1,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ module Ci
|
|||
partition_foreign_key: :partition_id
|
||||
belongs_to :runner, class_name: 'Ci::Runner'
|
||||
|
||||
enum runner_type: ::Ci::Runner.runner_types
|
||||
enum :runner_type, ::Ci::Runner.runner_types
|
||||
|
||||
def self.upsert_build!(build)
|
||||
raise ArgumentError, 'build has not been picked by a runner' if build.runner.nil?
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ module Ci
|
|||
query_constraints :id, :partition_id
|
||||
partitionable scope: :pipeline, partitioned: true
|
||||
|
||||
enum status: Ci::HasStatus::STATUSES_ENUM
|
||||
enum :status, Ci::HasStatus::STATUSES_ENUM
|
||||
|
||||
belongs_to :project
|
||||
belongs_to :pipeline, ->(stage) { in_partition(stage) },
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ module Clusters
|
|||
scope :active, -> { where(status: :active) }
|
||||
scope :connected, -> { active.where("last_used_at > ?", Clusters::Agent::INACTIVE_AFTER.ago) }
|
||||
|
||||
enum status: {
|
||||
enum :status, {
|
||||
active: 0,
|
||||
revoked: 1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,21 +19,21 @@ module Clusters
|
|||
|
||||
nullify_if_blank :detail
|
||||
|
||||
enum kind: {
|
||||
enum :kind, {
|
||||
token_created: 0,
|
||||
token_revoked: 1,
|
||||
agent_connected: 2,
|
||||
agent_disconnected: 3
|
||||
}, _prefix: true
|
||||
}, prefix: true
|
||||
|
||||
enum level: {
|
||||
enum :level, {
|
||||
debug: 0,
|
||||
info: 1,
|
||||
warn: 2,
|
||||
error: 3,
|
||||
fatal: 4,
|
||||
unknown: 5
|
||||
}, _prefix: true
|
||||
}, prefix: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -73,17 +73,17 @@ module Clusters
|
|||
alias_attribute :base_domain, :domain
|
||||
alias_attribute :provided_by_user?, :user?
|
||||
|
||||
enum cluster_type: {
|
||||
enum :cluster_type, {
|
||||
instance_type: 1,
|
||||
group_type: 2,
|
||||
project_type: 3
|
||||
}
|
||||
|
||||
enum platform_type: {
|
||||
enum :platform_type, {
|
||||
kubernetes: 1
|
||||
}
|
||||
|
||||
enum provider_type: {
|
||||
enum :provider_type, {
|
||||
user: 0,
|
||||
gcp: 1,
|
||||
aws: 2
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ module Clusters
|
|||
validates :enabled, inclusion: { in: [true, false] }
|
||||
|
||||
# Periodically checked and kept up to date for Monitor demo projects
|
||||
enum health_status: {
|
||||
enum :health_status, {
|
||||
unknown: 0,
|
||||
healthy: 1,
|
||||
unhealthy: 2
|
||||
|
|
|
|||
|
|
@ -63,11 +63,11 @@ module Clusters
|
|||
|
||||
alias_attribute :ca_pem, :ca_cert
|
||||
|
||||
enum authorization_type: {
|
||||
enum :authorization_type, {
|
||||
unknown_authorization: nil,
|
||||
rbac: 1,
|
||||
abac: 2
|
||||
}, _default: :rbac
|
||||
}, default: :rbac
|
||||
|
||||
nullify_if_blank :namespace
|
||||
|
||||
|
|
|
|||
|
|
@ -37,10 +37,10 @@ class CommitStatus < Ci::ApplicationRecord
|
|||
|
||||
attribute :retried, default: false
|
||||
|
||||
enum scheduling_type: { stage: 0, dag: 1 }, _prefix: true
|
||||
enum :scheduling_type, { stage: 0, dag: 1 }, prefix: true
|
||||
# We use `Enums::Ci::CommitStatus.failure_reasons` here so that EE can more easily
|
||||
# extend this `Hash` with new values.
|
||||
enum failure_reason: Enums::Ci::CommitStatus.failure_reasons
|
||||
enum :failure_reason, Enums::Ci::CommitStatus.failure_reasons
|
||||
|
||||
delegate :commit, to: :pipeline
|
||||
delegate :sha, :short_sha, :before_sha, to: :pipeline
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ module Analytics
|
|||
validate :validate_stage_event_pairs
|
||||
validate :validate_labels
|
||||
|
||||
enum start_event_identifier: Gitlab::Analytics::CycleAnalytics::StageEvents.to_enum,
|
||||
_prefix: :start_event_identifier
|
||||
enum end_event_identifier: Gitlab::Analytics::CycleAnalytics::StageEvents.to_enum,
|
||||
_prefix: :end_event_identifier
|
||||
enum :start_event_identifier, Gitlab::Analytics::CycleAnalytics::StageEvents.to_enum,
|
||||
prefix: :start_event_identifier
|
||||
enum :end_event_identifier, Gitlab::Analytics::CycleAnalytics::StageEvents.to_enum,
|
||||
prefix: :end_event_identifier
|
||||
|
||||
alias_attribute :custom_stage?, :custom
|
||||
scope :default_stages, -> { where(custom: false) }
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ module Ci
|
|||
JUNIT_MAX_BYTES = 100.megabytes
|
||||
|
||||
included do
|
||||
enum file_format: {
|
||||
enum :file_format, {
|
||||
raw: 1,
|
||||
zip: 2,
|
||||
gzip: 3
|
||||
}, _suffix: true
|
||||
}, suffix: true
|
||||
|
||||
scope :expired_before, ->(timestamp) { where(arel_table[:expire_at].lt(timestamp)) }
|
||||
scope :expired, -> { expired_before(Time.current) }
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ module Ci
|
|||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
enum executor_type: {
|
||||
enum :executor_type, {
|
||||
unknown: 0,
|
||||
custom: 1,
|
||||
shell: 2,
|
||||
|
|
@ -20,7 +20,7 @@ module Ci
|
|||
kubernetes: 11,
|
||||
docker_autoscaler: 12,
|
||||
instance: 13
|
||||
}, _suffix: true
|
||||
}, suffix: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ module Ci
|
|||
included do
|
||||
include Gitlab::EncryptedAttribute
|
||||
|
||||
enum variable_type: {
|
||||
enum :variable_type, {
|
||||
env_var: 1,
|
||||
file: 2
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ module Ci
|
|||
# The values should be the same as `Ci::Pipeline.lockeds` with the
|
||||
# additional value of `unknown` to indicate rows that have not
|
||||
# yet been populated from the parent Ci::Pipeline
|
||||
enum locked: {
|
||||
enum :locked, {
|
||||
unlocked: 0,
|
||||
artifacts_locked: 1,
|
||||
unknown: 2
|
||||
}, _prefix: :artifact
|
||||
}, prefix: :artifact
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ module CommitSignature
|
|||
|
||||
sha_attribute :commit_sha
|
||||
|
||||
enum verification_status: Enums::CommitSignature.verification_statuses
|
||||
enum :verification_status, Enums::CommitSignature.verification_statuses
|
||||
|
||||
belongs_to :project, class_name: 'Project', foreign_key: 'project_id', optional: false
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ module HasUserType
|
|||
INTERNAL_USER_TYPES = (USER_TYPES.keys - NON_INTERNAL_USER_TYPES).freeze
|
||||
|
||||
included do
|
||||
enum user_type: USER_TYPES
|
||||
enum :user_type, USER_TYPES
|
||||
|
||||
scope :bots, -> { where(user_type: BOT_USER_TYPES) }
|
||||
scope :without_bots, -> { where(user_type: USER_TYPES.keys - BOT_USER_TYPES) }
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ module Import
|
|||
}.freeze
|
||||
|
||||
included do
|
||||
enum imported_from: IMPORT_SOURCES, _prefix: :imported_from
|
||||
enum :imported_from, IMPORT_SOURCES, prefix: :imported_from
|
||||
end
|
||||
|
||||
def imported?
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ module IssuableLink
|
|||
|
||||
scope :for_source_or_target, ->(issuable) { where(source: issuable).or(where(target: issuable)) }
|
||||
|
||||
enum link_type: Enums::IssuableLink.link_types
|
||||
enum :link_type, Enums::IssuableLink.link_types
|
||||
|
||||
private
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ module MergeRequestReviewerState
|
|||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
enum state: {
|
||||
enum :state, {
|
||||
unreviewed: 0,
|
||||
reviewed: 1,
|
||||
requested_changes: 2,
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ module Packages
|
|||
|
||||
delegate container_type, to: :component
|
||||
|
||||
enum file_type: { packages: 1, sources: 2, di_packages: 3 }
|
||||
enum compression_type: { gz: 1, bz2: 2, xz: 3 }
|
||||
enum :file_type, { packages: 1, sources: 2, di_packages: 3 }
|
||||
enum :compression_type, { gz: 1, bz2: 2, xz: 3 }
|
||||
|
||||
validates :component, presence: true
|
||||
validates :file_type, presence: true
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ module TtlExpirable
|
|||
attribute :read_at, default: -> { Time.zone.now }
|
||||
validates :status, presence: true
|
||||
|
||||
enum status: { default: 0, pending_destruction: 1, processing: 2, error: 3 }
|
||||
enum :status, { default: 0, pending_destruction: 1, processing: 2, error: 3 }
|
||||
|
||||
scope :read_before, ->(number_of_days) { where("read_at <= ?", Time.zone.now - number_of_days.days) }
|
||||
scope :active, -> { where(status: :default) }
|
||||
|
|
|
|||
|
|
@ -12,14 +12,14 @@ module UseSqlFunctionForPrimaryKeyLookups
|
|||
super(replaced.arel, ...)
|
||||
end
|
||||
|
||||
def cached_find_by_statement(key, &_block)
|
||||
def cached_find_by_statement(*args, **kwargs, &_block)
|
||||
transformed_block = proc do |params|
|
||||
original = yield(params)
|
||||
|
||||
replaced = try_replace_with_function_call(original.arel)
|
||||
replaced || original
|
||||
end
|
||||
super(key, &transformed_block)
|
||||
super(*args, **kwargs, &transformed_block)
|
||||
end
|
||||
|
||||
# Tries to replace an arel representation of a primary key lookup with an optimized function call.
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ module ContainerRegistry
|
|||
|
||||
belongs_to :project, optional: false
|
||||
|
||||
enum status: { ongoing: 0, completed: 1, failed: 2 }
|
||||
enum :status, { ongoing: 0, completed: 1, failed: 2 }
|
||||
|
||||
scope :ongoing_since, ->(threshold) { where(status: :ongoing).where('updated_at < ?', threshold) }
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,12 +3,10 @@
|
|||
module ContainerRegistry
|
||||
module Protection
|
||||
class Rule < ApplicationRecord
|
||||
enum minimum_access_level_for_delete:
|
||||
Gitlab::Access.sym_options_with_admin.slice(:maintainer, :owner, :admin),
|
||||
_prefix: :minimum_access_level_for_delete
|
||||
enum minimum_access_level_for_push:
|
||||
Gitlab::Access.sym_options_with_admin.slice(:maintainer, :owner, :admin),
|
||||
_prefix: :minimum_access_level_for_push
|
||||
enum :minimum_access_level_for_delete, Gitlab::Access.sym_options_with_admin.slice(:maintainer, :owner, :admin),
|
||||
prefix: :minimum_access_level_for_delete
|
||||
enum :minimum_access_level_for_push, Gitlab::Access.sym_options_with_admin.slice(:maintainer, :owner, :admin),
|
||||
prefix: :minimum_access_level_for_push
|
||||
|
||||
belongs_to :project, inverse_of: :container_registry_protection_rules
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ class ContainerRepository < ApplicationRecord
|
|||
validates :failed_deletion_count, presence: true
|
||||
validates :failed_deletion_count, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: MAX_DELETION_FAILURES }
|
||||
|
||||
enum status: { delete_scheduled: 0, delete_failed: 1, delete_ongoing: 2 }
|
||||
enum expiration_policy_cleanup_status: { cleanup_unscheduled: 0, cleanup_scheduled: 1, cleanup_unfinished: 2, cleanup_ongoing: 3 }
|
||||
enum :status, { delete_scheduled: 0, delete_failed: 1, delete_ongoing: 2 }
|
||||
enum :expiration_policy_cleanup_status, { cleanup_unscheduled: 0, cleanup_scheduled: 1, cleanup_unfinished: 2, cleanup_ongoing: 3 }
|
||||
|
||||
delegate :client, :gitlab_api_client, to: :registry
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class CustomerRelations::Contact < ApplicationRecord
|
|||
|
||||
strip_attributes! :phone, :first_name, :last_name
|
||||
|
||||
enum state: {
|
||||
enum :state, {
|
||||
inactive: 0,
|
||||
active: 1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class CustomerRelations::Organization < ApplicationRecord
|
|||
|
||||
strip_attributes! :name
|
||||
|
||||
enum state: {
|
||||
enum :state, {
|
||||
inactive: 0,
|
||||
active: 1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class DeployToken < ApplicationRecord
|
|||
|
||||
validates :expires_at, iso8601_date: true, on: :create
|
||||
validates :deploy_token_type, presence: true
|
||||
enum deploy_token_type: {
|
||||
enum :deploy_token_type, {
|
||||
group_type: 1,
|
||||
project_type: 2
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ class Deployment < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
enum status: {
|
||||
enum :status, {
|
||||
created: 0,
|
||||
running: 1,
|
||||
success: 2,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ module DesignManagement
|
|||
belongs_to :design, class_name: "DesignManagement::Design", inverse_of: :actions
|
||||
belongs_to :version, class_name: "DesignManagement::Version", inverse_of: :actions
|
||||
|
||||
enum event: { creation: 0, modification: 1, deletion: 2 }
|
||||
enum :event, { creation: 0, modification: 1, deletion: 2 }
|
||||
|
||||
# we assume sequential ordering.
|
||||
scope :ordered, -> { order(version_id: :asc) }
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ class DiffNotePosition < ApplicationRecord
|
|||
belongs_to :note
|
||||
attr_accessor :line_range
|
||||
|
||||
enum diff_content_type: {
|
||||
enum :diff_content_type, {
|
||||
text: 0,
|
||||
image: 1
|
||||
}
|
||||
|
||||
enum diff_type: {
|
||||
enum :diff_type, {
|
||||
head: 0
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class DraftNote < ApplicationRecord
|
|||
validates :discussion_id, allow_nil: true, format: { with: /\A\h{40}\z/ }
|
||||
validates :line_code, length: { maximum: 255 }, allow_nil: true
|
||||
|
||||
enum note_type: {
|
||||
enum :note_type, {
|
||||
Note: 0,
|
||||
DiffNote: 1,
|
||||
DiscussionNote: 2
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ class Environment < ApplicationRecord
|
|||
where(auto_delete_at: nil)
|
||||
end
|
||||
|
||||
enum tier: {
|
||||
enum :tier, {
|
||||
production: 0,
|
||||
staging: 1,
|
||||
testing: 2,
|
||||
|
|
@ -202,10 +202,10 @@ class Environment < ApplicationRecord
|
|||
other: 4
|
||||
}
|
||||
|
||||
enum auto_stop_setting: {
|
||||
enum :auto_stop_setting, {
|
||||
always: 0,
|
||||
with_action: 1
|
||||
}, _prefix: true
|
||||
}, prefix: true
|
||||
|
||||
state_machine :state, initial: :available do
|
||||
event :start do
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class ErrorTracking::Error < ApplicationRecord
|
|||
validates :platform, length: { maximum: 255 }
|
||||
validates :status, presence: true
|
||||
|
||||
enum status: {
|
||||
enum :status, {
|
||||
unresolved: 0,
|
||||
resolved: 1,
|
||||
ignored: 2
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class Event < ApplicationRecord
|
|||
|
||||
sha_attribute :fingerprint
|
||||
|
||||
enum action: ACTIONS, _suffix: true
|
||||
enum :action, ACTIONS, suffix: true
|
||||
|
||||
delegate :name, :email, :public_email, :username, to: :author, prefix: true, allow_nil: true
|
||||
delegate :title, to: :issue, prefix: true, allow_nil: true
|
||||
|
|
|
|||
|
|
@ -12,16 +12,6 @@ class GroupDeployKey < Key
|
|||
joins(:group_deploy_keys_groups).where(group_deploy_keys_groups: { group_id: group_ids }).uniq
|
||||
end
|
||||
|
||||
# Remove usage_type because it defined in Key class but doesn't have a column in group_deploy_keys table
|
||||
def self.defined_enums
|
||||
super.without('usage_type')
|
||||
end
|
||||
|
||||
# Remove Key#usage_type from attributes to avoid defining enum for it
|
||||
def self.attributes_to_define_after_schema_loads
|
||||
super.without('usage_type')
|
||||
end
|
||||
|
||||
def type
|
||||
'DeployKey'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ module Integrations
|
|||
before_save :format_project_keys, if: :project_keys_changed?
|
||||
after_commit :update_deployment_type, on: [:create, :update], if: :update_deployment_type?
|
||||
|
||||
enum comment_detail: {
|
||||
enum :comment_detail, {
|
||||
standard: 1,
|
||||
all_details: 2
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@ module Integrations
|
|||
attr_encrypted :username, encryption_options
|
||||
attr_encrypted :password, encryption_options
|
||||
|
||||
enum deployment_type: { unknown: 0, server: 1, cloud: 2 }, _prefix: :deployment
|
||||
enum :deployment_type, { unknown: 0, server: 1, cloud: 2 }, prefix: :deployment
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class InternalId < ApplicationRecord
|
|||
belongs_to :project
|
||||
belongs_to :namespace
|
||||
|
||||
enum usage: Enums::InternalId.usage_resources
|
||||
enum :usage, Enums::InternalId.usage_resources
|
||||
|
||||
validates :usage, presence: true
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class IssuableSeverity < ApplicationRecord
|
|||
validates :issue, presence: true, uniqueness: true
|
||||
validates :severity, presence: true
|
||||
|
||||
enum severity: {
|
||||
enum :severity, {
|
||||
unknown: 0,
|
||||
low: 1,
|
||||
medium: 2,
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class JiraImportState < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
enum status: STATUSES
|
||||
enum :status, STATUSES
|
||||
|
||||
def in_progress?
|
||||
scheduled? || started?
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ class Key < ApplicationRecord
|
|||
|
||||
delegate :name, :email, to: :user, prefix: true
|
||||
|
||||
enum usage_type: {
|
||||
attribute :usage_type, :integer, limit: 2
|
||||
enum :usage_type, {
|
||||
auth_and_signing: 0,
|
||||
auth: 1,
|
||||
signing: 2
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class List < ApplicationRecord
|
|||
|
||||
has_many :list_user_preferences
|
||||
|
||||
enum list_type: { backlog: 0, label: 1, closed: 2, assignee: 3, milestone: 4, iteration: 5 }
|
||||
enum :list_type, { backlog: 0, label: 1, closed: 2, assignee: 3, milestone: 4, iteration: 5 }
|
||||
|
||||
validates :board, :list_type, presence: true, unless: :importing?
|
||||
validates :label_id, uniqueness: { scope: :board_id }, if: :label?
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class LooseForeignKeys::DeletedRecord < Gitlab::Database::SharedModel
|
|||
scope :for_partition, ->(partition) { where(partition: partition) }
|
||||
scope :consume_order, -> { order(:partition, :consume_after, :id) }
|
||||
|
||||
enum status: { pending: 1, processed: 2 }, _prefix: :status
|
||||
enum :status, { pending: 1, processed: 2 }, prefix: :status
|
||||
|
||||
def self.load_batch_for_table(table, batch_size)
|
||||
partition_names = Gitlab::Database::PostgresPartitionedTable.each_partition(table_name).map(&:name)
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class MergeRequestDiff < ApplicationRecord
|
|||
state :overflow_diff_lines_limit
|
||||
end
|
||||
|
||||
enum diff_type: {
|
||||
enum :diff_type, {
|
||||
regular: 1,
|
||||
merge_head: 2
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ module Ml
|
|||
include Presentable
|
||||
include AtomicInternalId
|
||||
|
||||
enum status: { running: 0, scheduled: 1, finished: 2, failed: 3, killed: 4 }
|
||||
enum :status, { running: 0, scheduled: 1, finished: 2, failed: 3, killed: 4 }
|
||||
|
||||
PACKAGE_PREFIX = 'candidate_'
|
||||
|
||||
|
|
|
|||
|
|
@ -23,13 +23,13 @@ class Namespace::RootStorageStatistics < ApplicationRecord
|
|||
|
||||
delegate :all_projects_except_soft_deleted, to: :namespace
|
||||
|
||||
enum notification_level: {
|
||||
enum :notification_level, {
|
||||
storage_remaining: 100,
|
||||
caution: 30,
|
||||
warning: 15,
|
||||
danger: 5,
|
||||
exceeded: 0
|
||||
}, _prefix: true
|
||||
}, prefix: true
|
||||
|
||||
def recalculate!
|
||||
update!(merged_attributes)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class NamespaceSetting < ApplicationRecord
|
|||
columns_changing_default :require_dpop_for_manage_api_endpoints
|
||||
|
||||
ignore_column :token_expiry_notify_inherited, remove_with: '17.9', remove_after: '2025-01-11'
|
||||
enum pipeline_variables_default_role: ProjectCiCdSetting::PIPELINE_VARIABLES_OVERRIDE_ROLES, _prefix: true
|
||||
enum :pipeline_variables_default_role, ProjectCiCdSetting::PIPELINE_VARIABLES_OVERRIDE_ROLES, prefix: true
|
||||
|
||||
ignore_column :third_party_ai_features_enabled, remove_with: '16.11', remove_after: '2024-04-18'
|
||||
ignore_column :code_suggestions, remove_with: '17.8', remove_after: '2024-05-16'
|
||||
|
|
@ -21,9 +21,9 @@ class NamespaceSetting < ApplicationRecord
|
|||
|
||||
belongs_to :namespace, inverse_of: :namespace_settings
|
||||
|
||||
enum jobs_to_be_done: { basics: 0, move_repository: 1, code_storage: 2, exploring: 3, ci: 4, other: 5 }, _suffix: true
|
||||
enum enabled_git_access_protocol: { all: 0, ssh: 1, http: 2 }, _suffix: true
|
||||
enum seat_control: { off: 0, user_cap: 1, block_overages: 2 }, _prefix: true
|
||||
enum :jobs_to_be_done, { basics: 0, move_repository: 1, code_storage: 2, exploring: 3, ci: 4, other: 5 }, suffix: true
|
||||
enum :enabled_git_access_protocol, { all: 0, ssh: 1, http: 2 }, suffix: true
|
||||
enum :seat_control, { off: 0, user_cap: 1, block_overages: 2 }, prefix: true
|
||||
|
||||
attribute :default_branch_protection_defaults, default: -> { {} }
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ module Namespaces
|
|||
#
|
||||
# TODO: we can remove these attribute aliases when we no longer need to sync these with project model,
|
||||
# see ProjectNamespace#sync_attributes_from_project
|
||||
alias_attribute :namespace, :parent
|
||||
alias_method :namespace, :parent
|
||||
alias_attribute :namespace_id, :parent_id
|
||||
has_one :project, inverse_of: :project_namespace
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class NotificationSetting < ApplicationRecord
|
|||
include EachBatch
|
||||
include FromUnion
|
||||
|
||||
enum level: { global: 3, watch: 2, participating: 1, mention: 4, disabled: 0, custom: 5 }, _default: :global
|
||||
enum :level, { global: 3, watch: 2, participating: 1, mention: 4, disabled: 0, custom: 5 }, default: :global
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :source, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ module Operations
|
|||
|
||||
scope :new_version_only, -> { where(version: :new_version_flag) }
|
||||
|
||||
enum version: {
|
||||
enum :version, {
|
||||
new_version_flag: 2
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ module Organizations
|
|||
|
||||
before_destroy :ensure_user_has_an_organization
|
||||
|
||||
enum access_level: {
|
||||
enum :access_level, {
|
||||
# Until we develop more access_levels, we really don't know if the default access_level will be what we think of
|
||||
# as a guest. For now, we'll set to same value as guest, but call it default to denote the current ambivalence.
|
||||
default: Gitlab::Access::GUEST,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class Packages::Conan::FileMetadatum < ApplicationRecord
|
|||
validate :conan_package_type
|
||||
validate :ensure_recipe_revision_with_package_revision
|
||||
|
||||
enum conan_file_type: { recipe_file: 1, package_file: 2 }
|
||||
enum :conan_file_type, { recipe_file: 1, package_file: 2 }
|
||||
|
||||
RECIPE_FILES = ::Gitlab::Regex::Packages::CONAN_RECIPE_FILES
|
||||
PACKAGE_FILES = ::Gitlab::Regex::Packages::CONAN_PACKAGE_FILES
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module Packages
|
|||
validates :package_file, presence: true
|
||||
validate :valid_debian_package_type
|
||||
|
||||
enum file_type: {
|
||||
enum :file_type, {
|
||||
unknown: 1, source: 2, dsc: 3, deb: 4, udeb: 5, buildinfo: 6, changes: 7, ddeb: 8
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class Packages::DependencyLink < ApplicationRecord
|
|||
validates :dependency_type,
|
||||
uniqueness: { scope: %i[package_id dependency_id] }
|
||||
|
||||
enum dependency_type: { dependencies: 1, devDependencies: 2, bundleDependencies: 3, peerDependencies: 4 }
|
||||
enum :dependency_type, { dependencies: 1, devDependencies: 2, bundleDependencies: 3, peerDependencies: 4 }
|
||||
|
||||
scope :with_dependency_type, ->(dependency_type) { where(dependency_type: dependency_type) }
|
||||
scope :includes_dependency, -> { includes(:dependency) }
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ module Packages
|
|||
include Packages::Downloadable
|
||||
include Packages::Destructible
|
||||
|
||||
enum status: { default: 0, processing: 1, pending_destruction: 2, error: 3 }
|
||||
enum :status, { default: 0, processing: 1, pending_destruction: 2, error: 3 }
|
||||
|
||||
belongs_to :project, inverse_of: :npm_metadata_caches
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class Packages::Package < ApplicationRecord
|
|||
DETAILED_INFO_STATUSES = [:default, :deprecated].freeze
|
||||
STATUS_MESSAGE_MAX_LENGTH = 255
|
||||
|
||||
enum package_type: {
|
||||
enum :package_type, {
|
||||
maven: 1,
|
||||
npm: 2,
|
||||
conan: 3,
|
||||
|
|
@ -31,7 +31,7 @@ class Packages::Package < ApplicationRecord
|
|||
ml_model: 14
|
||||
}
|
||||
|
||||
enum status: { default: 0, hidden: 1, processing: 2, error: 3, pending_destruction: 4, deprecated: 5 }
|
||||
enum :status, { default: 0, hidden: 1, processing: 2, error: 3, pending_destruction: 4, deprecated: 5 }
|
||||
|
||||
belongs_to :project
|
||||
belongs_to :creator, class_name: 'User'
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class Packages::PackageFile < ApplicationRecord
|
|||
delegate :file_type, :dsc?, :component, :architecture, :fields, to: :debian_file_metadatum, prefix: :debian
|
||||
delegate :channel, :metadata, to: :helm_file_metadatum, prefix: :helm
|
||||
|
||||
enum status: { default: 0, pending_destruction: 1, processing: 2, error: 3 }
|
||||
enum :status, { default: 0, pending_destruction: 1, processing: 2, error: 3 }
|
||||
|
||||
belongs_to :package
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue