summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2018-01-06 00:40:15 +0000
committerRobert Speicher <robert@gitlab.com>2018-01-06 00:40:15 +0000
commitbfc1cf06b62658a040828304a623a6647cd4f6db (patch)
tree1cb0cf6757fdcafeaa5a80eefe9dddae8a6c46da /db
parentaa4a335f4a5768e8ddf0444f42cd8927a738b4d5 (diff)
parent1572902586b4e7538d6c826b8ba314f629b445ca (diff)
downloadgitlab-ce-bfc1cf06b62658a040828304a623a6647cd4f6db.tar.gz
Merge branch 'fix-ce-migration-timestamp' into 'master'
Fix rebase commit SHA migration name See merge request gitlab-org/gitlab-ce!16256
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20160621123729_add_rebase_commit_sha_to_merge_requests.rb22
-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
3 files changed, 37 insertions, 7 deletions
diff --git a/db/migrate/20160621123729_add_rebase_commit_sha_to_merge_requests.rb b/db/migrate/20160621123729_add_rebase_commit_sha_to_merge_requests.rb
new file mode 100644
index 00000000000..1222dc640a8
--- /dev/null
+++ b/db/migrate/20160621123729_add_rebase_commit_sha_to_merge_requests.rb
@@ -0,0 +1,22 @@
+# This migration is a duplicate of 20171230123729_add_rebase_commit_sha_to_merge_requests_ce.rb
+#
+# We backported this feature from EE using the same migration, but with a new
+# timestamp, which caused an error when the backport was then to be merged back
+# into EE.
+#
+# See discussion at https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/3932
+class AddRebaseCommitShaToMergeRequests < 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
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