Commit 38cd44c1 authored by Douwe Maan's avatar Douwe Maan Committed by Rémy Coutable

Merge branch '24059-post-facto-fixups' into 'master'

Fixups to "Round-robin repository storage"

## What does this MR do?

* Simplifies a method in application_settings.rb
* Correctly marks a migration as needing downtime
* Documents the requirement for renamed columns to be 

## Are there points in the code the reviewer needs to double check?

Should any of these changes be split out? Ideally we'd get this into the same point release as !7273

## Why was this MR needed?

Post-facto review of !7273

## Screenshots (if relevant)

## Does this MR meet the acceptance criteria?

- [ ] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG.md) entry added
- [X] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [X] API support added
- Tests
  - [X] Added for this feature/bug
  - [x] All builds are passing
- [X] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [X] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [X] Branch has no merge conflicts with `master` (if it does - rebase it please)
- [X] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

## What are the relevant issue numbers?

Related to #24059

/cc @yorickpeterse @rspeicher

See merge request !7287
parent 182064b6
...@@ -202,11 +202,7 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -202,11 +202,7 @@ class ApplicationSetting < ActiveRecord::Base
end end
def repository_storages def repository_storages
value = read_attribute(:repository_storages) Array(read_attribute(:repository_storages))
value = [value] if value.is_a?(String)
value = [] if value.nil?
value
end end
# repository_storage is still required in the API. Remove in 9.0 # repository_storage is still required in the API. Remove in 9.0
......
...@@ -5,12 +5,12 @@ class RenameRepositoryStorageColumn < ActiveRecord::Migration ...@@ -5,12 +5,12 @@ class RenameRepositoryStorageColumn < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
DOWNTIME = false DOWNTIME = true
# When a migration requires downtime you **must** uncomment the following # When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the # constant and define a short and easy to understand explanation as to why the
# migration requires downtime. # migration requires downtime.
# DOWNTIME_REASON = '' DOWNTIME_REASON = 'Renaming the application_settings.repository_storage column'
# When using the methods "add_concurrent_index" or "add_column_with_default" # When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an # you must disable the use of transactions as these methods can not run in an
......
...@@ -66,6 +66,12 @@ producing errors whenever it tries to use the `dummy` column. ...@@ -66,6 +66,12 @@ producing errors whenever it tries to use the `dummy` column.
As a result of the above downtime _is_ required when removing a column, even As a result of the above downtime _is_ required when removing a column, even
when using PostgreSQL. when using PostgreSQL.
## Renaming Columns
Renaming columns requires downtime as running GitLab instances will continue
using the old column name until a new version is deployed. This can result
in the instance producing errors, which in turn can impact the user experience.
## Changing Column Constraints ## Changing Column Constraints
Generally changing column constraints requires checking all rows in the table to Generally changing column constraints requires checking all rows in the table to
......
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