diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-05-19 23:11:40 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-05-19 23:11:40 +0300 |
commit | 52c8b9da37451943fe97f3a687d43ae39105aaa0 (patch) | |
tree | 1a4136d0ab951f1d895ed100ae99f3fb5c8d25bf /db/migrate/20160504112519_add_run_untagged_to_ci_runner.rb | |
parent | 4cc77c3bf8ef72d1b08160da9f55eb1c5f95e832 (diff) |
Use migration helper to prevent downtime migration
Diffstat (limited to 'db/migrate/20160504112519_add_run_untagged_to_ci_runner.rb')
-rw-r--r-- | db/migrate/20160504112519_add_run_untagged_to_ci_runner.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/db/migrate/20160504112519_add_run_untagged_to_ci_runner.rb b/db/migrate/20160504112519_add_run_untagged_to_ci_runner.rb index c6753f2b398..84e5e4eabe2 100644 --- a/db/migrate/20160504112519_add_run_untagged_to_ci_runner.rb +++ b/db/migrate/20160504112519_add_run_untagged_to_ci_runner.rb @@ -1,11 +1,13 @@ class AddRunUntaggedToCiRunner < ActiveRecord::Migration - ## - # Downtime expected! - # - # This migration will cause downtime due to exclusive lock - # caused by the default value. - # - def change - add_column :ci_runners, :run_untagged, :boolean, default: true, null: false + include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + + def up + add_column_with_default(:ci_runners, :run_untagged, :boolean, + default: true, allow_null: false) + end + + def down + remove_column(:ci_runners, :run_untagged) end end |