summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-10-05 14:49:16 +0900
committerShinya Maeda <shinya@gitlab.com>2017-10-05 14:49:16 +0900
commit88cc9d5294198cfa748d602236729abcd73f56a6 (patch)
tree6eb5be9ed46ec720ba195702d80e166980868146 /db
parentd6e22e83d1fe8ffaa71c3bcb7906731733a89f0e (diff)
parent8921af39e74976e37e92c786bd957883110f6522 (diff)
downloadgitlab-ce-88cc9d5294198cfa748d602236729abcd73f56a6.tar.gz
Merge branch 'master' into feature/sm/35954-create-kubernetes-cluster-on-gke-from-k8s-service
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20150827121444_add_fast_forward_option_to_project.rb6
-rw-r--r--db/migrate/20171004121444_make_sure_fast_forward_option_exists.rb25
-rw-r--r--db/schema.rb2
3 files changed, 30 insertions, 3 deletions
diff --git a/db/migrate/20150827121444_add_fast_forward_option_to_project.rb b/db/migrate/20150827121444_add_fast_forward_option_to_project.rb
index 014f5b2f372..6f22641077d 100644
--- a/db/migrate/20150827121444_add_fast_forward_option_to_project.rb
+++ b/db/migrate/20150827121444_add_fast_forward_option_to_project.rb
@@ -7,11 +7,13 @@ class AddFastForwardOptionToProject < ActiveRecord::Migration
disable_ddl_transaction!
- def add
+ def up
add_column_with_default(:projects, :merge_requests_ff_only_enabled, :boolean, default: false)
end
def down
- remove_column(:projects, :merge_requests_ff_only_enabled)
+ if column_exists?(:projects, :merge_requests_ff_only_enabled)
+ remove_column(:projects, :merge_requests_ff_only_enabled)
+ end
end
end
diff --git a/db/migrate/20171004121444_make_sure_fast_forward_option_exists.rb b/db/migrate/20171004121444_make_sure_fast_forward_option_exists.rb
new file mode 100644
index 00000000000..ac266c3e22e
--- /dev/null
+++ b/db/migrate/20171004121444_make_sure_fast_forward_option_exists.rb
@@ -0,0 +1,25 @@
+# rubocop:disable all
+class MakeSureFastForwardOptionExists < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ # We had to fix the migration db/migrate/20150827121444_add_fast_forward_option_to_project.rb
+ # And this is why it's possible that someone has ran the migrations but does
+ # not have the merge_requests_ff_only_enabled column. This migration makes sure it will
+ # be added
+ unless column_exists?(:projects, :merge_requests_ff_only_enabled)
+ add_column_with_default(:projects, :merge_requests_ff_only_enabled, :boolean, default: false)
+ end
+ end
+
+ def down
+ if column_exists?(:projects, :merge_requests_ff_only_enabled)
+ remove_column(:projects, :merge_requests_ff_only_enabled)
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index cf0d54a3248..e7391ac9826 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: 20170928100231) do
+ActiveRecord::Schema.define(version: 20171004121444) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"