Commit 02510015 authored by Rémy Coutable's avatar Rémy Coutable Committed by Robert Speicher

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 2af769c3)
parent 9fcadef5
......@@ -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
......
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