summaryrefslogtreecommitdiff
path: root/lib/gitlab/database/migration_helpers.rb
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-06-13 11:22:58 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2016-06-13 11:22:58 +0200
commitb33b7be53e113e4f07154b6aafb7858d76d99516 (patch)
tree28c672476c27ec57184eff6246fb160c94924801 /lib/gitlab/database/migration_helpers.rb
parent65df6bcb898e067e380658431136b5ef9aaba3b0 (diff)
downloadgitlab-ce-b33b7be53e113e4f07154b6aafb7858d76d99516.tar.gz
Handle NULL migration errors in migration helpers
This ensures that whenever changing the NULL constraint of a column fails we still drop the column.
Diffstat (limited to 'lib/gitlab/database/migration_helpers.rb')
-rw-r--r--lib/gitlab/database/migration_helpers.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb
index 978c3f7896d..0f488e968f6 100644
--- a/lib/gitlab/database/migration_helpers.rb
+++ b/lib/gitlab/database/migration_helpers.rb
@@ -126,6 +126,8 @@ module Gitlab
begin
transaction do
update_column_in_batches(table, column, default)
+
+ change_column_null(table, column, false) unless allow_null
end
# We want to rescue _all_ exceptions here, even those that don't inherit
# from StandardError.
@@ -134,8 +136,6 @@ module Gitlab
raise error
end
-
- change_column_null(table, column, false) unless allow_null
end
end
end