diff options
author | Sean McGivern <sean@gitlab.com> | 2017-07-25 17:57:02 +0100 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-07-26 15:34:57 +0100 |
commit | 396b8f91ec47ffb5a02ebf6d713ef4cbf04f1f94 (patch) | |
tree | c27074b1608622faa29efb8275be983a9331b2db /db | |
parent | 0c563225b663742b4f26731dc7bc822a38f7289b (diff) | |
download | gitlab-ce-396b8f91ec47ffb5a02ebf6d713ef4cbf04f1f94.tar.gz |
Fix saving diffs that are not valid UTF-835539-can-t-create-a-merge-request-containing-a-binary-file-with-non-utf-8-characters
Previously, we used Psych, which would:
1. Check if a string was encoded as binary, and not ASCII-compatible.
2. Add the !binary tag in that case.
3. Convert to base64.
We need to do the same thing, using a new column in place of the tag.
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20170725145659_add_binary_to_merge_request_diff_files.rb | 9 | ||||
-rw-r--r-- | db/schema.rb | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/db/migrate/20170725145659_add_binary_to_merge_request_diff_files.rb b/db/migrate/20170725145659_add_binary_to_merge_request_diff_files.rb new file mode 100644 index 00000000000..1f5fa7e3d49 --- /dev/null +++ b/db/migrate/20170725145659_add_binary_to_merge_request_diff_files.rb @@ -0,0 +1,9 @@ +class AddBinaryToMergeRequestDiffFiles < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + add_column :merge_request_diff_files, :binary, :boolean + end +end diff --git a/db/schema.rb b/db/schema.rb index 61bcd8c7e95..1ec25c7d46f 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: 20170724214302) do +ActiveRecord::Schema.define(version: 20170725145659) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -748,6 +748,7 @@ ActiveRecord::Schema.define(version: 20170724214302) do t.text "new_path", null: false t.text "old_path", null: false t.text "diff", null: false + t.boolean "binary" end add_index "merge_request_diff_files", ["merge_request_diff_id", "relative_order"], name: "index_merge_request_diff_files_on_mr_diff_id_and_order", unique: true, using: :btree |