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
Léo-Paul Géneau
gitlab-ce
Commits
dbee8148
Commit
dbee8148
authored
Apr 05, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reschedule pipeline stages migration to run it again
parent
4ef3e835
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
23 deletions
+41
-23
db/post_migrate/20180212101928_schedule_build_stage_migration.rb
..._migrate/20180212101928_schedule_build_stage_migration.rb
+5
-20
db/post_migrate/20180405101928_reschedule_builds_stages_migration.rb
...rate/20180405101928_reschedule_builds_stages_migration.rb
+33
-0
db/schema.rb
db/schema.rb
+1
-1
spec/migrations/reschedule_builds_stages_migration_spec.rb
spec/migrations/reschedule_builds_stages_migration_spec.rb
+2
-2
No files found.
db/post_migrate/20180212101928_schedule_build_stage_migration.rb
View file @
dbee8148
class
ScheduleBuildStageMigration
<
ActiveRecord
::
Migration
class
ScheduleBuildStageMigration
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
##
# This migration has been rescheduled to run again, see
DOWNTIME
=
false
# `20180405101928_reschedule_builds_stages_migration.rb`
MIGRATION
=
'MigrateBuildStage'
.
freeze
#
BATCH_SIZE
=
500
disable_ddl_transaction!
class
Build
<
ActiveRecord
::
Base
include
EachBatch
self
.
table_name
=
'ci_builds'
end
def
up
def
up
disable_statement_timeout
# noop
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
end
end
def
down
def
down
...
...
db/post_migrate/20180405101928_reschedule_builds_stages_migration.rb
0 → 100644
View file @
dbee8148
class
RescheduleBuildsStagesMigration
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
##
# Rescheduled `20180212101928_schedule_build_stage_migration.rb`
#
DOWNTIME
=
false
MIGRATION
=
'MigrateBuildStage'
.
freeze
BATCH_SIZE
=
500
disable_ddl_transaction!
class
Build
<
ActiveRecord
::
Base
include
EachBatch
self
.
table_name
=
'ci_builds'
end
def
up
disable_statement_timeout
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
end
def
down
# noop
end
end
db/schema.rb
View file @
dbee8148
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
#
# It's strongly recommended that you check this file into your version control system.
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
20180
327101207
)
do
ActiveRecord
::
Schema
.
define
(
version:
20180
405101928
)
do
# These are extensions that must be enabled in order to support this database
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
enable_extension
"plpgsql"
...
...
spec/migrations/
schedule_build_stage
_migration_spec.rb
→
spec/migrations/
reschedule_builds_stages
_migration_spec.rb
View file @
dbee8148
require
'spec_helper'
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20180
212101928_schedule_build_stage
_migration'
)
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20180
405101928_reschedule_builds_stages
_migration'
)
describe
ScheduleBuildStage
Migration
,
:sidekiq
,
:migration
do
describe
RescheduleBuildsStages
Migration
,
:sidekiq
,
:migration
do
let
(
:projects
)
{
table
(
:projects
)
}
let
(
:projects
)
{
table
(
:projects
)
}
let
(
:pipelines
)
{
table
(
:ci_pipelines
)
}
let
(
:pipelines
)
{
table
(
:ci_pipelines
)
}
let
(
:stages
)
{
table
(
:ci_stages
)
}
let
(
:stages
)
{
table
(
:ci_stages
)
}
...
...
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