summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-04-05 12:09:04 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2018-04-05 12:09:04 +0000
commit57ec7c618ebf4f32d8c38237e7ee120f3880df7a (patch)
tree4100a515aaaa6ac5336e1534c978da954e72f6fd /db
parent641bb13b906a7e178ff9ad11defa58276cc76a77 (diff)
parent8d012198778fee5b76b777c1a18b60bde62d6f8e (diff)
downloadgitlab-ce-57ec7c618ebf4f32d8c38237e7ee120f3880df7a.tar.gz
Merge branch 'fix/gb/reschedule-pipeline-stages-migration' into 'master'
Reschedule pipeline stages migration to run it again See merge request gitlab-org/gitlab-ce!18191
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20180212101928_schedule_build_stage_migration.rb25
-rw-r--r--db/post_migrate/20180405101928_reschedule_builds_stages_migration.rb33
-rw-r--r--db/schema.rb2
3 files changed, 39 insertions, 21 deletions
diff --git a/db/post_migrate/20180212101928_schedule_build_stage_migration.rb b/db/post_migrate/20180212101928_schedule_build_stage_migration.rb
index df15b2cd9d4..0f61fa81832 100644
--- a/db/post_migrate/20180212101928_schedule_build_stage_migration.rb
+++ b/db/post_migrate/20180212101928_schedule_build_stage_migration.rb
@@ -1,26 +1,11 @@
class ScheduleBuildStageMigration < ActiveRecord::Migration
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- MIGRATION = 'MigrateBuildStage'.freeze
- BATCH_SIZE = 500
-
- disable_ddl_transaction!
-
- class Build < ActiveRecord::Base
- include EachBatch
- self.table_name = 'ci_builds'
- end
+ ##
+ # This migration has been rescheduled to run again, see
+ # `20180405101928_reschedule_builds_stages_migration.rb`
+ #
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
+ # noop
end
def down
diff --git a/db/post_migrate/20180405101928_reschedule_builds_stages_migration.rb b/db/post_migrate/20180405101928_reschedule_builds_stages_migration.rb
new file mode 100644
index 00000000000..e19387bce1e
--- /dev/null
+++ b/db/post_migrate/20180405101928_reschedule_builds_stages_migration.rb
@@ -0,0 +1,33 @@
+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
diff --git a/db/schema.rb b/db/schema.rb
index 25e7d720761..2cd51b200b3 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20180327101207) do
+ActiveRecord::Schema.define(version: 20180405101928) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"