diff options
author | Valery Sizov <valery@gitlab.com> | 2017-10-04 12:42:28 +0300 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2017-10-04 12:42:28 +0300 |
commit | e40b018bc73176429ceb1498b7d206c17eeb3e05 (patch) | |
tree | 99f7a7daa43152c69771fc39b0f817bb494e7f37 /db/migrate/20171004121444_make_sure_fast_forward_option_exists.rb | |
parent | 416660c0225ad6acf98ed736aa7f23468ecc3299 (diff) | |
download | gitlab-ce-e40b018bc73176429ceb1498b7d206c17eeb3e05.tar.gz |
Add a new migration to make sure that fast forward column exists in projects tablefix_migration_with_fast_forward_option
Diffstat (limited to 'db/migrate/20171004121444_make_sure_fast_forward_option_exists.rb')
-rw-r--r-- | db/migrate/20171004121444_make_sure_fast_forward_option_exists.rb | 25 |
1 files changed, 25 insertions, 0 deletions
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 |