From 2ea0148c55fbefee1137c254a94b37c05dca41cf Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin <godfat@godfat.org> Date: Mon, 6 Jun 2016 18:20:30 +0800 Subject: [PATCH] Update migration with add_column_with_default: Feedback: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4093#note_12278454 --- db/migrate/20160509091049_add_locked_to_ci_runner.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/db/migrate/20160509091049_add_locked_to_ci_runner.rb b/db/migrate/20160509091049_add_locked_to_ci_runner.rb index 6294fa9d86b..43376304bd9 100644 --- a/db/migrate/20160509091049_add_locked_to_ci_runner.rb +++ b/db/migrate/20160509091049_add_locked_to_ci_runner.rb @@ -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 -- GitLab