diff options
Diffstat (limited to 'app/models/ml/candidate.rb')
| -rw-r--r-- | app/models/ml/candidate.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/models/ml/candidate.rb b/app/models/ml/candidate.rb index 02da09e6b51..c1409da05ec 100644 --- a/app/models/ml/candidate.rb +++ b/app/models/ml/candidate.rb @@ -3,7 +3,9 @@ module Ml class Candidate < ApplicationRecord include Sortable + include AtomicInternalId include IgnorableColumns + ignore_column :iid, remove_with: '16.0', remove_after: '2023-05-01' PACKAGE_PREFIX = 'ml_candidate_' @@ -16,6 +18,7 @@ module Ml belongs_to :experiment, class_name: 'Ml::Experiment' belongs_to :user belongs_to :package, class_name: 'Packages::Package' + belongs_to :project has_many :metrics, class_name: 'Ml::CandidateMetric' has_many :params, class_name: 'Ml::CandidateParam' has_many :metadata, class_name: 'Ml::CandidateMetadata' @@ -23,6 +26,10 @@ module Ml attribute :eid, default: -> { SecureRandom.uuid } + has_internal_id :internal_id, + scope: :project, + init: AtomicInternalId.project_init(self, :internal_id) + scope :including_relationships, -> { includes(:latest_metrics, :params, :user, :package) } scope :by_name, ->(name) { where("ml_candidates.name LIKE ?", "%#{sanitize_sql_like(name)}%") } # rubocop:disable GitlabSecurity/SqlInjection scope :order_by_metric, ->(metric, direction) do @@ -49,8 +56,6 @@ module Ml ) end - delegate :project_id, :project, to: :experiment - alias_attribute :artifact, :package # Remove alias after https://gitlab.com/gitlab-org/gitlab/-/merge_requests/115401 |
