summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-07-21 16:24:38 +0000
committerRobert Speicher <rspeicher@gmail.com>2016-07-21 14:03:48 -0600
commit02510015259b689cf24f4fe081e2df8f550402b2 (patch)
tree9dddd12085adfbc68ad65ef8805e2b4b5b49b0c1
parent9fcadef50636ffd4a77c4e174880d4a3c572a89b (diff)
downloadgitlab-ce-02510015259b689cf24f4fe081e2df8f550402b2.tar.gz
Merge branch 'fix-has-external-wiki-migration' into 'master'
Don't drop in DropAndReaddHasExternalWikiInProjects ## What does this MR do? This MR fixes the migration in question so it doesn't first drop and then re-add a column. ## Are there points in the code the reviewer needs to double check? Not really. ## Why was this MR needed? The old migration could lead to application errors as the column would temporarily not exist between the drop column and add column statements. ## What are the relevant issue numbers? https://gitlab.com/gitlab-com/infrastructure/issues/239 ## Does this MR meet the acceptance criteria? - [x] ~~[CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added~~ - [x] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~ - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [ ] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !5402 (cherry picked from commit 2af769c336e0a2498333ea8b4d7b7c87810ca5f0)
-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