diff --git a/db/migrate/20190416185130_add_merge_train_enabled_to_ci_cd_settings.rb b/db/migrate/20190416185130_add_merge_train_enabled_to_ci_cd_settings.rb new file mode 100644 index 00000000000..eb0e7c41f98 --- /dev/null +++ b/db/migrate/20190416185130_add_merge_train_enabled_to_ci_cd_settings.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddMergeTrainEnabledToCiCdSettings < ActiveRecord::Migration[5.1] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_column_with_default :project_ci_cd_settings, :merge_trains_enabled, :boolean, default: false, allow_null: false + end + + def down + remove_column :project_ci_cd_settings, :merge_trains_enabled + end +end diff --git a/db/schema.rb b/db/schema.rb index 5a486b369e3..2e77bbb51e5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1612,6 +1612,7 @@ ActiveRecord::Schema.define(version: 20190426180107) do t.integer "project_id", null: false t.boolean "group_runners_enabled", default: true, null: false t.boolean "merge_pipelines_enabled" + t.boolean "merge_trains_enabled", default: false, null: false t.index ["project_id"], name: "index_project_ci_cd_settings_on_project_id", unique: true, using: :btree end diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index f61857ea5ff..06dcc44d35b 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -2123,7 +2123,7 @@ describe MergeRequest do end context 'when merges are not restricted to green builds' do - subject { build(:merge_request, target_project: build(:project, only_allow_merge_if_pipeline_succeeds: false)) } + subject { build(:merge_request, target_project: create(:project, only_allow_merge_if_pipeline_succeeds: false)) } context 'and a failed pipeline is associated' do before do