diff options
author | Jason Goodman <jgoodman@gitlab.com> | 2019-06-28 07:48:57 +0300 |
---|---|---|
committer | Thong Kuah <tkuah@gitlab.com> | 2019-06-28 07:48:57 +0300 |
commit | 96b116d0998df5b026b168e686add915fdf2e719 (patch) | |
tree | e558ec7fc798f354884e02343beb473e07c96732 /lib | |
parent | 732ee60693c5986f9041b05665588306eefd69d9 (diff) |
Support jsonb Default Value in add_column_with_default Migration Helper
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/database/migration_helpers.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index 0b12e862ded..e2cbf91f281 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -434,7 +434,8 @@ module Gitlab end begin - update_column_in_batches(table, column, default, &block) + default_after_type_cast = connection.type_cast(default, column_for(table, column)) + update_column_in_batches(table, column, default_after_type_cast, &block) change_column_null(table, column, false) unless allow_null # We want to rescue _all_ exceptions here, even those that don't inherit |