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
a1cd3390
Commit
a1cd3390
authored
Mar 21, 2018
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add project_id column to Ci::BuildMetadata
parent
afcc57ab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
app/models/ci/build_metadata.rb
app/models/ci/build_metadata.rb
+11
-0
db/migrate/20180301010859_create_ci_builds_metadata_table.rb
db/migrate/20180301010859_create_ci_builds_metadata_table.rb
+4
-0
db/schema.rb
db/schema.rb
+4
-0
No files found.
app/models/ci/build_metadata.rb
View file @
a1cd3390
...
...
@@ -9,9 +9,12 @@ module Ci
self
.
table_name
=
'ci_builds_metadata'
belongs_to
:build
,
class_name:
'Ci::Build'
belongs_to
:project
chronic_duration_attr_reader
:timeout_human_readable
,
:timeout
after_initialize
:set_project_id
enum
timeout_source:
{
unknown_timeout_source:
1
,
project_timeout_source:
2
,
...
...
@@ -27,5 +30,13 @@ module Ci
update_attributes
(
timeout:
timeout
,
timeout_source:
timeout_source
)
end
private
def
set_project_id
return
unless
self
.
project_id
.
nil?
self
.
project_id
=
build
&
.
project
&
.
id
end
end
end
db/migrate/20180301010859_create_ci_builds_metadata_table.rb
View file @
a1cd3390
...
...
@@ -6,11 +6,15 @@ class CreateCiBuildsMetadataTable < ActiveRecord::Migration
def
change
create_table
:ci_builds_metadata
,
id:
false
do
|
t
|
t
.
integer
:build_id
,
null:
false
t
.
integer
:project_id
,
null:
false
t
.
integer
:timeout
t
.
integer
:timeout_source
,
null:
false
,
default:
1
t
.
primary_key
:build_id
t
.
foreign_key
:ci_builds
,
column: :build_id
,
on_delete: :cascade
t
.
foreign_key
:projects
,
column: :project_id
,
on_delete: :cascade
t
.
index
:project_id
end
end
end
db/schema.rb
View file @
a1cd3390
...
...
@@ -330,10 +330,13 @@ ActiveRecord::Schema.define(version: 20180327101207) do
add_index
"ci_builds"
,
[
"user_id"
],
name:
"index_ci_builds_on_user_id"
,
using: :btree
create_table
"ci_builds_metadata"
,
primary_key:
"build_id"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
,
null:
false
t
.
integer
"timeout"
t
.
integer
"timeout_source"
,
default:
1
,
null:
false
end
add_index
"ci_builds_metadata"
,
[
"project_id"
],
name:
"index_ci_builds_metadata_on_project_id"
,
using: :btree
create_table
"ci_group_variables"
,
force: :cascade
do
|
t
|
t
.
string
"key"
,
null:
false
t
.
text
"value"
...
...
@@ -2035,6 +2038,7 @@ ActiveRecord::Schema.define(version: 20180327101207) do
add_foreign_key
"ci_builds"
,
"ci_stages"
,
column:
"stage_id"
,
name:
"fk_3a9eaa254d"
,
on_delete: :cascade
add_foreign_key
"ci_builds"
,
"projects"
,
name:
"fk_befce0568a"
,
on_delete: :cascade
add_foreign_key
"ci_builds_metadata"
,
"ci_builds"
,
column:
"build_id"
,
on_delete: :cascade
add_foreign_key
"ci_builds_metadata"
,
"projects"
,
on_delete: :cascade
add_foreign_key
"ci_group_variables"
,
"namespaces"
,
column:
"group_id"
,
name:
"fk_33ae4d58d8"
,
on_delete: :cascade
add_foreign_key
"ci_job_artifacts"
,
"ci_builds"
,
column:
"job_id"
,
on_delete: :cascade
add_foreign_key
"ci_job_artifacts"
,
"projects"
,
on_delete: :cascade
...
...
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