diff options
author | Rémy Coutable <remy@rymai.me> | 2016-07-21 16:24:38 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-07-21 16:24:38 +0000 |
commit | 2af769c336e0a2498333ea8b4d7b7c87810ca5f0 (patch) | |
tree | dd1bf75e8882ebb04af7cdb3fc0b589380b28393 | |
parent | 6a9a250a5385886a2a0db78512608adb06d4327a (diff) | |
parent | b7c5cf9edb0b58d885be7783dd5f6ada756ccacd (diff) | |
download | gitlab-ce-2af769c336e0a2498333ea8b4d7b7c87810ca5f0.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
-rw-r--r-- | db/migrate/20160721081015_drop_and_readd_has_external_wiki_in_projects.rb | 5 |
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 |