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
Jérome Perrin
gitlab-ce
Commits
1a6dbaef
Commit
1a6dbaef
authored
Feb 16, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add back database changes for Ci::Build
parent
a978a5e0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
2 deletions
+27
-2
db/migrate/20180119160751_optimize_ci_job_artifacts.rb
db/migrate/20180119160751_optimize_ci_job_artifacts.rb
+23
-0
db/schema.rb
db/schema.rb
+2
-0
spec/factories/ci/builds.rb
spec/factories/ci/builds.rb
+2
-2
No files found.
db/migrate/20180119160751_optimize_ci_job_artifacts.rb
0 → 100644
View file @
1a6dbaef
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
OptimizeCiJobArtifacts
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
false
disable_ddl_transaction!
def
up
# job_id is just here to be a covering index for index only scans
# since we'll almost always be joining against ci_builds on job_id
add_concurrent_index
(
:ci_job_artifacts
,
[
:expire_at
,
:job_id
])
add_concurrent_index
(
:ci_builds
,
[
:artifacts_expire_at
],
where:
"artifacts_file <> ''"
)
end
def
down
remove_concurrent_index
(
:ci_job_artifacts
,
[
:expire_at
,
:job_id
])
remove_concurrent_index
(
:ci_builds
,
[
:artifacts_expire_at
],
where:
"artifacts_file <> ''"
)
end
end
db/schema.rb
View file @
1a6dbaef
...
@@ -293,6 +293,7 @@ ActiveRecord::Schema.define(version: 20180208183958) do
...
@@ -293,6 +293,7 @@ ActiveRecord::Schema.define(version: 20180208183958) do
t
.
integer
"failure_reason"
t
.
integer
"failure_reason"
end
end
add_index
"ci_builds"
,
[
"artifacts_expire_at"
],
name:
"index_ci_builds_on_artifacts_expire_at"
,
where:
"(artifacts_file <> ''::text)"
,
using: :btree
add_index
"ci_builds"
,
[
"auto_canceled_by_id"
],
name:
"index_ci_builds_on_auto_canceled_by_id"
,
using: :btree
add_index
"ci_builds"
,
[
"auto_canceled_by_id"
],
name:
"index_ci_builds_on_auto_canceled_by_id"
,
using: :btree
add_index
"ci_builds"
,
[
"commit_id"
,
"stage_idx"
,
"created_at"
],
name:
"index_ci_builds_on_commit_id_and_stage_idx_and_created_at"
,
using: :btree
add_index
"ci_builds"
,
[
"commit_id"
,
"stage_idx"
,
"created_at"
],
name:
"index_ci_builds_on_commit_id_and_stage_idx_and_created_at"
,
using: :btree
add_index
"ci_builds"
,
[
"commit_id"
,
"status"
,
"type"
],
name:
"index_ci_builds_on_commit_id_and_status_and_type"
,
using: :btree
add_index
"ci_builds"
,
[
"commit_id"
,
"status"
,
"type"
],
name:
"index_ci_builds_on_commit_id_and_status_and_type"
,
using: :btree
...
@@ -333,6 +334,7 @@ ActiveRecord::Schema.define(version: 20180208183958) do
...
@@ -333,6 +334,7 @@ ActiveRecord::Schema.define(version: 20180208183958) do
t
.
string
"file"
t
.
string
"file"
end
end
add_index
"ci_job_artifacts"
,
[
"expire_at"
,
"job_id"
],
name:
"index_ci_job_artifacts_on_expire_at_and_job_id"
,
using: :btree
add_index
"ci_job_artifacts"
,
[
"job_id"
,
"file_type"
],
name:
"index_ci_job_artifacts_on_job_id_and_file_type"
,
unique:
true
,
using: :btree
add_index
"ci_job_artifacts"
,
[
"job_id"
,
"file_type"
],
name:
"index_ci_job_artifacts_on_job_id_and_file_type"
,
unique:
true
,
using: :btree
add_index
"ci_job_artifacts"
,
[
"project_id"
],
name:
"index_ci_job_artifacts_on_project_id"
,
using: :btree
add_index
"ci_job_artifacts"
,
[
"project_id"
],
name:
"index_ci_job_artifacts_on_project_id"
,
using: :btree
...
...
spec/factories/ci/builds.rb
View file @
1a6dbaef
...
@@ -180,8 +180,8 @@ FactoryBot.define do
...
@@ -180,8 +180,8 @@ FactoryBot.define do
trait
:artifacts
do
trait
:artifacts
do
after
(
:create
)
do
|
build
|
after
(
:create
)
do
|
build
|
create
(
:ci_job_artifact
,
:archive
,
job:
build
)
create
(
:ci_job_artifact
,
:archive
,
job:
build
,
expire_at:
build
.
artifacts_expire_at
)
create
(
:ci_job_artifact
,
:metadata
,
job:
build
)
create
(
:ci_job_artifact
,
:metadata
,
job:
build
,
expire_at:
build
.
artifacts_expire_at
)
build
.
reload
build
.
reload
end
end
end
end
...
...
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