Commit 2af769c3 authored by Rémy Coutable's avatar Rémy Coutable

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
parents 6a9a250a b7c5cf9e
...@@ -5,8 +5,9 @@ class DropAndReaddHasExternalWikiInProjects < ActiveRecord::Migration ...@@ -5,8 +5,9 @@ class DropAndReaddHasExternalWikiInProjects < ActiveRecord::Migration
DOWNTIME = false DOWNTIME = false
def up def up
remove_column :projects, :has_external_wiki, :boolean update_column_in_batches(:projects, :has_external_wiki, nil) do |table, query|
add_column :projects, :has_external_wiki, :boolean query.where(table[:has_external_wiki].not_eq(nil))
end
end end
def down def down
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment