summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-07-21 17:43:43 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2016-07-21 17:43:43 +0200
commitb7c5cf9edb0b58d885be7783dd5f6ada756ccacd (patch)
treeac1766e1fbb4d1f5494e2dba545607fc6b3b9852
parent2d7516ffbdacc488016573752c6672fb5a15dcc5 (diff)
downloadgitlab-ce-fix-has-external-wiki-migration.tar.gz
Don't drop in DropAndReaddHasExternalWikiInProjectsfix-has-external-wiki-migration
Dropping a column and then re-adding it can lead to the application throwing errors as the column may temporarily not exist. To work around this we'll reset the various project rows in batches _without_ removing any columns.
-rw-r--r--db/migrate/20160721081015_drop_and_readd_has_external_wiki_in_projects.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/db/migrate/20160721081015_drop_and_readd_has_external_wiki_in_projects.rb b/db/migrate/20160721081015_drop_and_readd_has_external_wiki_in_projects.rb
index 459a120155d..1eb99feb40c 100644
--- a/db/migrate/20160721081015_drop_and_readd_has_external_wiki_in_projects.rb
+++ b/db/migrate/20160721081015_drop_and_readd_has_external_wiki_in_projects.rb
@@ -5,8 +5,9 @@ class DropAndReaddHasExternalWikiInProjects < ActiveRecord::Migration
DOWNTIME = false
def up
- remove_column :projects, :has_external_wiki, :boolean
- add_column :projects, :has_external_wiki, :boolean
+ update_column_in_batches(:projects, :has_external_wiki, nil) do |table, query|
+ query.where(table[:has_external_wiki].not_eq(nil))
+ end
end
def down