Commit 591f10f6 authored by Alejandro Rodríguez's avatar Alejandro Rodríguez

Update 8.14-rc1 migrations to minimize downtime and deploy time

See https://gitlab.com/gitlab-org/gitlab-ce/issues/24386
parent 67041e63
...@@ -1334,6 +1334,10 @@ class Project < ActiveRecord::Base ...@@ -1334,6 +1334,10 @@ class Project < ActiveRecord::Base
end end
end end
def only_allow_merge_if_all_discussions_are_resolved
super || false
end
private private
def pushes_since_gc_redis_key def pushes_since_gc_redis_key
......
...@@ -5,10 +5,7 @@ class OnlyAllowMergeIfAllDiscussionsAreResolved < ActiveRecord::Migration ...@@ -5,10 +5,7 @@ class OnlyAllowMergeIfAllDiscussionsAreResolved < ActiveRecord::Migration
disable_ddl_transaction! disable_ddl_transaction!
def up def up
add_column_with_default(:projects, add_column :projects, :only_allow_merge_if_all_discussions_are_resolved, :boolean
:only_allow_merge_if_all_discussions_are_resolved,
:boolean,
default: false)
end end
def down def down
......
...@@ -912,7 +912,7 @@ ActiveRecord::Schema.define(version: 20161109150329) do ...@@ -912,7 +912,7 @@ ActiveRecord::Schema.define(version: 20161109150329) do
t.boolean "has_external_wiki" t.boolean "has_external_wiki"
t.boolean "lfs_enabled" t.boolean "lfs_enabled"
t.text "description_html" t.text "description_html"
t.boolean "only_allow_merge_if_all_discussions_are_resolved", default: false, null: false t.boolean "only_allow_merge_if_all_discussions_are_resolved"
end end
add_index "projects", ["ci_id"], name: "index_projects_on_ci_id", using: :btree add_index "projects", ["ci_id"], name: "index_projects_on_ci_id", using: :btree
......
...@@ -360,6 +360,14 @@ describe API::API, api: true do ...@@ -360,6 +360,14 @@ describe API::API, api: true do
expect(json_response['only_allow_merge_if_all_discussions_are_resolved']).to be_falsey expect(json_response['only_allow_merge_if_all_discussions_are_resolved']).to be_falsey
end end
it 'sets a project as allowing merge if only_allow_merge_if_all_discussions_are_resolved is nil' do
project = attributes_for(:project, only_allow_merge_if_all_discussions_are_resolved: nil)
post api('/projects', user), project
expect(json_response['only_allow_merge_if_all_discussions_are_resolved']).to be_falsey
end
it 'sets a project as allowing merge only if all discussions are resolved' do it 'sets a project as allowing merge only if all discussions are resolved' do
project = attributes_for(:project, { only_allow_merge_if_all_discussions_are_resolved: true }) project = attributes_for(:project, { only_allow_merge_if_all_discussions_are_resolved: true })
......
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