Commit 08678441 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'fix_migration_with_fast_forward_option' into 'master'

Fix AddFastForwardOptionToProject migration

See merge request gitlab-org/gitlab-ce!14676
parents 4a4f8093 e40b018b
...@@ -7,11 +7,13 @@ class AddFastForwardOptionToProject < ActiveRecord::Migration ...@@ -7,11 +7,13 @@ class AddFastForwardOptionToProject < ActiveRecord::Migration
disable_ddl_transaction! disable_ddl_transaction!
def add def up
add_column_with_default(:projects, :merge_requests_ff_only_enabled, :boolean, default: false) add_column_with_default(:projects, :merge_requests_ff_only_enabled, :boolean, default: false)
end end
def down 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
end end
# 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
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # 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 # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment