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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
1aa67247
Commit
1aa67247
authored
May 19, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add temporary partial index to speed up the migration
Closes #32469
parent
01a7f333
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
14 deletions
+28
-14
db/post_migrate/20170503004427_upate_retried_for_ci_build.rb
db/post_migrate/20170503004427_upate_retried_for_ci_build.rb
+28
-14
No files found.
db/post_migrate/20170503004427_upate_retried_for_ci_build.rb
View file @
1aa67247
...
...
@@ -8,6 +8,7 @@ class UpateRetriedForCiBuild < ActiveRecord::Migration
def
up
disable_statement_timeout
with_temporary_partial_index
do
latest_id
=
<<-
SQL
.
strip_heredoc
SELECT MAX(ci_builds2.id)
FROM ci_builds ci_builds2
...
...
@@ -23,7 +24,20 @@ class UpateRetriedForCiBuild < ActiveRecord::Migration
query
.
where
(
table
[
:retried
].
eq
(
nil
))
end
end
end
def
down
end
def
with_temporary_partial_index
if
Gitlab
::
Database
.
postgresql?
execute
'CREATE INDEX CONCURRENTLY IF NOT EXISTS index_for_ci_builds_retried_migration ON ci_builds (id) WHERE retried IS NULL;'
end
yield
if
Gitlab
::
Database
.
postgresql?
execute
'DROP INDEX CONCURRENTLY IF EXISTS index_for_ci_builds_retried_migration'
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