forked from Gitlink/forgeplus
ADD ci namespace modle associations
This commit is contained in:
parent
d802b8aba4
commit
217dfc03b2
|
@ -1,6 +1,6 @@
|
|||
class Ci::CloudAccount < Ci::LocalBase
|
||||
belongs_to :user
|
||||
belongs_to :ci_user, class_name: 'Ci::User', foreign_key: :ci_user_id
|
||||
belongs_to :ci_user, class_name: 'Ci::User', foreign_key: :ci_user_id, optional: true
|
||||
|
||||
def drone_host
|
||||
[drone_ip, ":80"].join
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
class Ci::Log < Ci::RemoteBase
|
||||
self.primary_key = 'log_id'
|
||||
self.primary_key = nil
|
||||
|
||||
belongs_to :step, class_name: 'Ci::Step', foreign_key: :log_id
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class Ci::Perm < Ci::RemoteBase
|
||||
self.primary_key = nil
|
||||
|
||||
belongs_to :ci_user, class_name: 'Ci::User', foreign_key: :perm_user_id
|
||||
|
||||
belongs_to :user, class_name: 'Ci::User', foreign_key: :perm_user_id
|
||||
belongs_to :repo, class_name: 'Ci::Repo', foreign_key: :perm_repo_uid
|
||||
end
|
||||
|
|
|
@ -2,6 +2,7 @@ class Ci::Repo < Ci::RemoteBase
|
|||
self.primary_key = 'repo_id'
|
||||
|
||||
belongs_to :user, foreign_key: :repo_user_id
|
||||
has_one :perm, foreign_key: :perm_repo_uid, dependent: :destroy
|
||||
has_many :builds, foreign_key: "build_repo_id", dependent: :destroy
|
||||
|
||||
def self.find_with_namespace(namespace_path, identifier)
|
||||
|
|
|
@ -2,4 +2,5 @@ class Ci::Step < Ci::RemoteBase
|
|||
self.primary_key = 'step_id'
|
||||
|
||||
belongs_to :stage, foreign_key: :step_stage_id
|
||||
has_one :log, class_name: 'Ci::Log', foreign_key: :log_id
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue