diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-08-25 12:59:21 -0500 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-08-25 12:59:21 -0500 |
commit | bbd9a6fe405d0df1c7c9ad09b7c3ff6a0201953f (patch) | |
tree | ebe142b4a13ff41691fdc75b348e718c3989a2df /db/migrate | |
parent | 532489dc045d6f0c6a215889be3f1d39097d1c83 (diff) | |
parent | a943ccf10ecf2af3331927cb83268fbc70f43634 (diff) | |
download | gitlab-ce-bbd9a6fe405d0df1c7c9ad09b7c3ff6a0201953f.tar.gz |
Merge branch 'dz-merge-request-version'
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20160725104020_merge_request_diff_remove_uniq.rb | 21 | ||||
-rw-r--r-- | db/migrate/20160725104452_merge_request_diff_add_index.rb | 17 |
2 files changed, 38 insertions, 0 deletions
diff --git a/db/migrate/20160725104020_merge_request_diff_remove_uniq.rb b/db/migrate/20160725104020_merge_request_diff_remove_uniq.rb new file mode 100644 index 00000000000..c8cbd2718ff --- /dev/null +++ b/db/migrate/20160725104020_merge_request_diff_remove_uniq.rb @@ -0,0 +1,21 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class MergeRequestDiffRemoveUniq < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + + DOWNTIME = false + + def up + if index_exists?(:merge_request_diffs, :merge_request_id) + remove_index :merge_request_diffs, :merge_request_id + end + end + + def down + unless index_exists?(:merge_request_diffs, :merge_request_id) + add_concurrent_index :merge_request_diffs, :merge_request_id, unique: true + end + end +end diff --git a/db/migrate/20160725104452_merge_request_diff_add_index.rb b/db/migrate/20160725104452_merge_request_diff_add_index.rb new file mode 100644 index 00000000000..6d04242dd25 --- /dev/null +++ b/db/migrate/20160725104452_merge_request_diff_add_index.rb @@ -0,0 +1,17 @@ +class MergeRequestDiffAddIndex < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + def up + add_concurrent_index :merge_request_diffs, :merge_request_id + end + + def down + if index_exists?(:merge_request_diffs, :merge_request_id) + remove_index :merge_request_diffs, :merge_request_id + end + end +end |