Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
cfee3e0c
Commit
cfee3e0c
authored
May 28, 2018
by
Kamil Trzciński
Committed by
Dylan Griffith
May 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `Ci::Runner` inverse_of's
parent
53ef14c6
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
8 deletions
+8
-8
app/models/ci/runner.rb
app/models/ci/runner.rb
+2
-2
app/models/ci/runner_namespace.rb
app/models/ci/runner_namespace.rb
+2
-2
app/models/ci/runner_project.rb
app/models/ci/runner_project.rb
+2
-2
app/models/namespace.rb
app/models/namespace.rb
+1
-1
app/models/project.rb
app/models/project.rb
+1
-1
No files found.
app/models/ci/runner.rb
View file @
cfee3e0c
...
...
@@ -12,9 +12,9 @@ module Ci
FORM_EDITABLE
=
%i[description tag_list active run_untagged locked access_level maximum_timeout_human_readable]
.
freeze
has_many
:builds
has_many
:runner_projects
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:runner_projects
,
inverse_of: :runner
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:projects
,
through: :runner_projects
has_many
:runner_namespaces
has_many
:runner_namespaces
,
inverse_of: :runner
has_many
:groups
,
through: :runner_namespaces
has_one
:last_build
,
->
()
{
order
(
'id DESC'
)
},
class_name:
'Ci::Build'
...
...
app/models/ci/runner_namespace.rb
View file @
cfee3e0c
...
...
@@ -2,8 +2,8 @@ module Ci
class
RunnerNamespace
<
ActiveRecord
::
Base
extend
Gitlab
::
Ci
::
Model
belongs_to
:runner
,
validate:
true
belongs_to
:namespace
,
class_name:
'::Namespace'
belongs_to
:runner
,
inverse_of: :runner_namespaces
,
validate:
true
belongs_to
:namespace
,
inverse_of: :runner_namespaces
,
class_name:
'::Namespace'
belongs_to
:group
,
class_name:
'::Group'
,
foreign_key: :namespace_id
end
end
app/models/ci/runner_project.rb
View file @
cfee3e0c
...
...
@@ -2,8 +2,8 @@ module Ci
class
RunnerProject
<
ActiveRecord
::
Base
extend
Gitlab
::
Ci
::
Model
belongs_to
:runner
belongs_to
:project
belongs_to
:runner
,
inverse_of: :runner_projects
belongs_to
:project
,
inverse_of: :runner_projects
validates
:runner_id
,
uniqueness:
{
scope: :project_id
}
end
...
...
app/models/namespace.rb
View file @
cfee3e0c
...
...
@@ -21,7 +21,7 @@ class Namespace < ActiveRecord::Base
has_many
:projects
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:project_statistics
has_many
:runner_namespaces
,
class_name:
'Ci::RunnerNamespace'
has_many
:runner_namespaces
,
inverse_of: :namespace
,
class_name:
'Ci::RunnerNamespace'
has_many
:runners
,
through: :runner_namespaces
,
source: :runner
,
class_name:
'Ci::Runner'
# This should _not_ be `inverse_of: :namespace`, because that would also set
...
...
app/models/project.rb
View file @
cfee3e0c
...
...
@@ -236,7 +236,7 @@ class Project < ActiveRecord::Base
has_many
:builds
,
class_name:
'Ci::Build'
,
inverse_of: :project
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:build_trace_section_names
,
class_name:
'Ci::BuildTraceSectionName'
has_many
:build_trace_chunks
,
class_name:
'Ci::BuildTraceChunk'
,
through: :builds
,
source: :trace_chunks
has_many
:runner_projects
,
class_name:
'Ci::RunnerProject'
has_many
:runner_projects
,
class_name:
'Ci::RunnerProject'
,
inverse_of: :project
has_many
:runners
,
through: :runner_projects
,
source: :runner
,
class_name:
'Ci::Runner'
has_many
:variables
,
class_name:
'Ci::Variable'
has_many
:triggers
,
class_name:
'Ci::Trigger'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment