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
2f3f9a6b
Commit
2f3f9a6b
authored
Feb 20, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate adding and removing index from stages migration
parent
2d027056
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
6 deletions
+29
-6
db/post_migrate/20180212101828_add_tmp_partial_null_index_to_builds.rb
...te/20180212101828_add_tmp_partial_null_index_to_builds.rb
+14
-0
db/post_migrate/20180212101928_schedule_build_stage_migration.rb
..._migrate/20180212101928_schedule_build_stage_migration.rb
+0
-5
db/post_migrate/20180212102028_remove_tmp_partial_null_index_from_builds.rb
...180212102028_remove_tmp_partial_null_index_from_builds.rb
+14
-0
db/schema.rb
db/schema.rb
+1
-1
No files found.
db/post_migrate/20180212101828_add_tmp_partial_null_index_to_builds.rb
0 → 100644
View file @
2f3f9a6b
class
AddTmpPartialNullIndexToBuilds
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
disable_ddl_transaction!
def
up
add_concurrent_index
(
:ci_builds
,
:stage_id
,
where:
'stage_id IS NULL'
,
name:
'tmp_stage_id_partial_null_index'
)
end
def
down
remove_concurrent_index_by_name
(
:ci_builds
,
'tmp_stage_id_partial_null_index'
)
end
end
db/post_migrate/20180212101928_schedule_build_stage_migration.rb
View file @
2f3f9a6b
...
...
@@ -15,17 +15,12 @@ class ScheduleBuildStageMigration < ActiveRecord::Migration
def
up
disable_statement_timeout
add_concurrent_index
(
:ci_builds
,
:stage_id
,
where:
'stage_id IS NULL'
,
name:
'tmp_stage_id_partial_null_index'
)
Build
.
where
(
'stage_id IS NULL'
).
tap
do
|
relation
|
queue_background_migration_jobs_by_range_at_intervals
(
relation
,
MIGRATION
,
5
.
minutes
,
batch_size:
BATCH_SIZE
)
end
remove_concurrent_index_by_name
(
:ci_builds
,
'tmp_stage_id_partial_null_index'
)
end
def
down
...
...
db/post_migrate/20180212102028_remove_tmp_partial_null_index_from_builds.rb
0 → 100644
View file @
2f3f9a6b
class
RemoveTmpPartialNullIndexFromBuilds
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
disable_ddl_transaction!
def
up
remove_concurrent_index_by_name
(
:ci_builds
,
'tmp_stage_id_partial_null_index'
)
end
def
down
add_concurrent_index
(
:ci_builds
,
:stage_id
,
where:
'stage_id IS NULL'
,
name:
'tmp_stage_id_partial_null_index'
)
end
end
db/schema.rb
View file @
2f3f9a6b
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2018021210
19
28
)
do
ActiveRecord
::
Schema
.
define
(
version:
2018021210
20
28
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
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