Update migration with add_column_with_default:

Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4093#note_12278454
This commit is contained in:
Lin Jen-Shin 2016-06-06 18:20:30 +08:00
parent 35954572b8
commit 2ea0148c55

View file

@ -2,7 +2,12 @@ class AddLockedToCiRunner < ActiveRecord::Migration
##
# Downtime expected due to exclusive lock when setting default value.
#
def change
add_column :ci_runners, :locked, :boolean, default: false, null: false
def up
add_column_with_default(:ci_runners, :locked, :boolean,
default: false, allow_null: false)
end
def down
remove_column(:ci_runners, :locked)
end
end