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
403decbb
Commit
403decbb
authored
Mar 26, 2018
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add explicit primary key for ci_builds_metadata table
parent
7008ed1e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
3 deletions
+6
-3
app/models/ci/build_metadata.rb
app/models/ci/build_metadata.rb
+1
-0
db/migrate/20180301010859_create_ci_builds_metadata_table.rb
db/migrate/20180301010859_create_ci_builds_metadata_table.rb
+2
-2
db/schema.rb
db/schema.rb
+3
-1
No files found.
app/models/ci/build_metadata.rb
View file @
403decbb
...
@@ -11,6 +11,7 @@ module Ci
...
@@ -11,6 +11,7 @@ module Ci
belongs_to
:build
,
class_name:
'Ci::Build'
belongs_to
:build
,
class_name:
'Ci::Build'
belongs_to
:project
belongs_to
:project
validates
:build
,
presence:
true
validates
:project
,
presence:
true
validates
:project
,
presence:
true
chronic_duration_attr_reader
:timeout_human_readable
,
:timeout
chronic_duration_attr_reader
:timeout_human_readable
,
:timeout
...
...
db/migrate/20180301010859_create_ci_builds_metadata_table.rb
View file @
403decbb
...
@@ -4,16 +4,16 @@ class CreateCiBuildsMetadataTable < ActiveRecord::Migration
...
@@ -4,16 +4,16 @@ class CreateCiBuildsMetadataTable < ActiveRecord::Migration
DOWNTIME
=
false
DOWNTIME
=
false
def
change
def
change
create_table
:ci_builds_metadata
,
id:
false
do
|
t
|
create_table
:ci_builds_metadata
do
|
t
|
t
.
integer
:build_id
,
null:
false
t
.
integer
:build_id
,
null:
false
t
.
integer
:project_id
,
null:
false
t
.
integer
:project_id
,
null:
false
t
.
integer
:timeout
t
.
integer
:timeout
t
.
integer
:timeout_source
,
null:
false
,
default:
1
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
:ci_builds
,
column: :build_id
,
on_delete: :cascade
t
.
foreign_key
:projects
,
column: :project_id
,
on_delete: :cascade
t
.
foreign_key
:projects
,
column: :project_id
,
on_delete: :cascade
t
.
index
:build_id
,
unique:
true
t
.
index
:project_id
t
.
index
:project_id
end
end
end
end
...
...
db/schema.rb
View file @
403decbb
...
@@ -329,12 +329,14 @@ ActiveRecord::Schema.define(version: 20180327101207) do
...
@@ -329,12 +329,14 @@ ActiveRecord::Schema.define(version: 20180327101207) do
add_index
"ci_builds"
,
[
"updated_at"
],
name:
"index_ci_builds_on_updated_at"
,
using: :btree
add_index
"ci_builds"
,
[
"updated_at"
],
name:
"index_ci_builds_on_updated_at"
,
using: :btree
add_index
"ci_builds"
,
[
"user_id"
],
name:
"index_ci_builds_on_user_id"
,
using: :btree
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
|
create_table
"ci_builds_metadata"
,
force: :cascade
do
|
t
|
t
.
integer
"build_id"
,
null:
false
t
.
integer
"project_id"
,
null:
false
t
.
integer
"project_id"
,
null:
false
t
.
integer
"timeout"
t
.
integer
"timeout"
t
.
integer
"timeout_source"
,
default:
1
,
null:
false
t
.
integer
"timeout_source"
,
default:
1
,
null:
false
end
end
add_index
"ci_builds_metadata"
,
[
"build_id"
],
name:
"index_ci_builds_metadata_on_build_id"
,
unique:
true
,
using: :btree
add_index
"ci_builds_metadata"
,
[
"project_id"
],
name:
"index_ci_builds_metadata_on_project_id"
,
using: :btree
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
|
create_table
"ci_group_variables"
,
force: :cascade
do
|
t
|
...
...
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