gitlab-org--gitlab-foss/app/models/clusters/project.rb
Mayra Cabrera e3ca493876 Add Clusters::KubernetesNamespace model
This model will be used to persist into database Kubernetes properties,
such as namespace, service account name and service account token.
2018-10-22 09:54:00 -05:00

13 lines
496 B
Ruby

# frozen_string_literal: true
module Clusters
class Project < ActiveRecord::Base
self.table_name = 'cluster_projects'
belongs_to :cluster, class_name: 'Clusters::Cluster'
belongs_to :project, class_name: '::Project'
has_many :kubernetes_namespaces, class_name: 'Clusters::KubernetesNamespace', foreign_key: :cluster_project_id
has_one :kubernetes_namespace, -> { order(id: :desc) }, class_name: 'Clusters::KubernetesNamespace', foreign_key: :cluster_project_id
end
end