summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2019-01-09 17:01:28 +0000
committerNick Thomas <nick@gitlab.com>2019-02-05 14:12:48 +0000
commitf9e41d0d851ae0ab1d67df63d0309fdce97517e1 (patch)
tree3c71a5853b789ff57d8a47522d8603c36eb7aa59 /db
parentf04910f254c29047dd3ae798161683a722e7162b (diff)
downloadgitlab-ce-f9e41d0d851ae0ab1d67df63d0309fdce97517e1.tar.gz
Allow MR diffs to be placed into an object store
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20190109153125_add_merge_request_external_diffs.rb25
-rw-r--r--db/schema.rb7
2 files changed, 31 insertions, 1 deletions
diff --git a/db/migrate/20190109153125_add_merge_request_external_diffs.rb b/db/migrate/20190109153125_add_merge_request_external_diffs.rb
new file mode 100644
index 00000000000..c67903c7f67
--- /dev/null
+++ b/db/migrate/20190109153125_add_merge_request_external_diffs.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddMergeRequestExternalDiffs < ActiveRecord::Migration[5.0]
+ include Gitlab::Database::MigrationHelpers
+
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ def change
+ # Allow the merge request diff to store details about an external file
+ add_column :merge_request_diffs, :external_diff, :string
+ add_column :merge_request_diffs, :external_diff_store, :integer
+ add_column :merge_request_diffs, :stored_externally, :boolean
+
+ # The diff for each file is mapped to a range in the external file
+ add_column :merge_request_diff_files, :external_diff_offset, :integer
+ add_column :merge_request_diff_files, :external_diff_size, :integer
+
+ # If the diff is in object storage, it will be null in the database
+ change_column_null :merge_request_diff_files, :diff, true
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 4b6e4992056..20c8dab4c3e 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1203,8 +1203,10 @@ ActiveRecord::Schema.define(version: 20190131122559) do
t.string "b_mode", null: false
t.text "new_path", null: false
t.text "old_path", null: false
- t.text "diff", null: false
+ t.text "diff"
t.boolean "binary"
+ t.integer "external_diff_offset"
+ t.integer "external_diff_size"
t.index ["merge_request_diff_id", "relative_order"], name: "index_merge_request_diff_files_on_mr_diff_id_and_order", unique: true, using: :btree
end
@@ -1218,6 +1220,9 @@ ActiveRecord::Schema.define(version: 20190131122559) do
t.string "head_commit_sha"
t.string "start_commit_sha"
t.integer "commits_count"
+ t.string "external_diff"
+ t.integer "external_diff_store"
+ t.boolean "stored_externally"
t.index ["merge_request_id", "id"], name: "index_merge_request_diffs_on_merge_request_id_and_id", using: :btree
end