summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2018-01-05 18:10:28 +0000
committerSean McGivern <sean@gitlab.com>2018-01-05 18:10:28 +0000
commit9ca49f8896f217a9bc7afa994faee933e78a2941 (patch)
treefcc573d57990d6eafe22fadec13551469c8b0828 /db
parent3d162d192ba2a57776de62b553a2a0a9a9245f8a (diff)
downloadgitlab-ce-9ca49f8896f217a9bc7afa994faee933e78a2941.tar.gz
Fix rebase commit SHA migration namefix-ce-migration-timestamp
This already existed in EE with a different timestamp, so rename for CE and make it idempotent.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20171230123729_add_rebase_commit_sha_to_merge_requests.rb7
-rw-r--r--db/migrate/20171230123729_add_rebase_commit_sha_to_merge_requests_ce.rb15
2 files changed, 15 insertions, 7 deletions
diff --git a/db/migrate/20171230123729_add_rebase_commit_sha_to_merge_requests.rb b/db/migrate/20171230123729_add_rebase_commit_sha_to_merge_requests.rb
deleted file mode 100644
index 2ce156fa92e..00000000000
--- a/db/migrate/20171230123729_add_rebase_commit_sha_to_merge_requests.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class AddRebaseCommitShaToMergeRequests < ActiveRecord::Migration
- DOWNTIME = false
-
- def change
- add_column :merge_requests, :rebase_commit_sha, :string
- end
-end
diff --git a/db/migrate/20171230123729_add_rebase_commit_sha_to_merge_requests_ce.rb b/db/migrate/20171230123729_add_rebase_commit_sha_to_merge_requests_ce.rb
new file mode 100644
index 00000000000..94a7c1019d8
--- /dev/null
+++ b/db/migrate/20171230123729_add_rebase_commit_sha_to_merge_requests_ce.rb
@@ -0,0 +1,15 @@
+class AddRebaseCommitShaToMergeRequestsCe < ActiveRecord::Migration
+ DOWNTIME = false
+
+ def up
+ unless column_exists?(:merge_requests, :rebase_commit_sha)
+ add_column :merge_requests, :rebase_commit_sha, :string
+ end
+ end
+
+ def down
+ if column_exists?(:merge_requests, :rebase_commit_sha)
+ remove_column :merge_requests, :rebase_commit_sha
+ end
+ end
+end