summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20170703130158_schedule_merge_request_diff_migrations.rb24
-rw-r--r--db/schema.rb2
2 files changed, 25 insertions, 1 deletions
diff --git a/db/post_migrate/20170703130158_schedule_merge_request_diff_migrations.rb b/db/post_migrate/20170703130158_schedule_merge_request_diff_migrations.rb
new file mode 100644
index 00000000000..ae53e3e1ab3
--- /dev/null
+++ b/db/post_migrate/20170703130158_schedule_merge_request_diff_migrations.rb
@@ -0,0 +1,24 @@
+class ScheduleMergeRequestDiffMigrations < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ class MergeRequestDiff < ActiveRecord::Base
+ self.table_name = 'merge_request_diffs'
+ end
+
+ def up
+ MergeRequestDiff.all.in_batches do |relation|
+ jobs = relation.pluck(:id).map do |id|
+ ['DeserializeMergeRequestDiffsAndCommits', [id]]
+ end
+
+ BackgroundMigrationWorker.perform_bulk(*jobs)
+ end
+ end
+
+ def down
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 4937f290d3e..b51e4942750 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: 20170623080805) do
+ActiveRecord::Schema.define(version: 20170703130158) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"