Don't drop in DropAndReaddHasExternalWikiInProjects

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.
This commit is contained in:
Yorick Peterse 2016-07-21 17:43:43 +02:00
parent 2d7516ffbd
commit b7c5cf9edb
No known key found for this signature in database
GPG Key ID: EDD30D2BEB691AC9
1 changed files with 3 additions and 2 deletions

View File

@ -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