Commit 47e0b3ee authored by Sean McGivern's avatar Sean McGivern

Merge branch...

Merge branch '12796-remove-merge_trains_enabled-column-from-project_ci_cd_settings-table-2' into 'master'

Remove merge_trains_enabled column from project_ci_cd_settings table

See merge request gitlab-org/gitlab!19701
parents d4b9ed59 31d81267
......@@ -4,7 +4,6 @@ class ProjectCiCdSetting < ApplicationRecord
include IgnorableColumns
# https://gitlab.com/gitlab-org/gitlab/issues/36651
ignore_column :merge_trains_enabled, remove_with: '12.7', remove_after: '2019-12-22'
belongs_to :project, inverse_of: :ci_cd_settings
# The version of the schema that first introduced this model/table.
......
# frozen_string_literal: true
class DropProjectCiCdSettingsMergeTrainsEnabled < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
remove_column :project_ci_cd_settings, :merge_trains_enabled
end
def down
add_column_with_default :project_ci_cd_settings, :merge_trains_enabled, :boolean, default: false, allow_null: true
end
end
......@@ -3098,7 +3098,6 @@ ActiveRecord::Schema.define(version: 2020_01_08_155731) 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.integer "default_git_depth"
t.index ["project_id"], name: "index_project_ci_cd_settings_on_project_id", unique: true
end
......
......@@ -158,7 +158,7 @@ module EE
delegate :log_jira_dvcs_integration_usage, :jira_dvcs_server_last_sync_at, :jira_dvcs_cloud_last_sync_at, to: :feature_usage
delegate :merge_pipelines_enabled, :merge_pipelines_enabled=, :merge_pipelines_enabled?, :merge_pipelines_were_disabled?, to: :ci_cd_settings
delegate :merge_trains_enabled, :merge_trains_enabled=, :merge_trains_enabled?, to: :ci_cd_settings
delegate :merge_trains_enabled?, to: :ci_cd_settings
delegate :actual_limits, to: :namespace, allow_nil: true
validates :repository_size_limit,
......
......@@ -8,9 +8,6 @@ module EE
project.feature_available?(:merge_pipelines) && super
end
# As of GitLab 12.1, merge trains option is enabled by default for all projects.
# We should drop `merge_trains_enabled` column after this application has been deployed.
# See more https://gitlab.com/gitlab-org/gitlab/issues/11222.
def merge_trains_enabled?
merge_pipelines_enabled? && project.feature_available?(:merge_trains) &&
::Feature.enabled?(:merge_trains_enabled, project, default_enabled: true)
......
title: Remove `project_ci_cd_settings.merge_trains_enabled` column
merge_request: 19701
author:
type: removed
......@@ -18,7 +18,7 @@ describe AutoMerge::AddToMergeTrainWhenPipelineSucceedsService do
before do
stub_licensed_features(merge_trains: true, merge_pipelines: true)
project.add_maintainer(user)
project.update!(merge_trains_enabled: true, merge_pipelines_enabled: true)
project.update!(merge_pipelines_enabled: true)
allow(AutoMergeProcessWorker).to receive(:perform_async) { }
merge_request.update_head_pipeline
end
......
......@@ -21,7 +21,7 @@ describe AutoMerge::MergeTrainService do
allow(AutoMergeProcessWorker).to receive(:perform_async) { }
stub_licensed_features(merge_trains: true, merge_pipelines: true)
project.update!(merge_trains_enabled: true, merge_pipelines_enabled: true)
project.update!(merge_pipelines_enabled: true)
end
describe '#execute' do
......
......@@ -11,7 +11,7 @@ describe MergeTrains::RefreshMergeRequestService do
before do
project.add_maintainer(maintainer)
stub_licensed_features(merge_pipelines: true, merge_trains: true)
project.update!(merge_pipelines_enabled: true, merge_trains_enabled: true)
project.update!(merge_pipelines_enabled: true)
end
describe '#execute' do
......
# frozen_string_literal: true
require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20191128162854_drop_project_ci_cd_settings_merge_trains_enabled.rb')
describe DropProjectCiCdSettingsMergeTrainsEnabled, :migration do
let!(:project_ci_cd_setting) { table(:project_ci_cd_settings) }
it 'correctly migrates up and down' do
reversible_migration do |migration|
migration.before -> {
expect(project_ci_cd_setting.column_names).to include("merge_trains_enabled")
}
migration.after -> {
project_ci_cd_setting.reset_column_information
expect(project_ci_cd_setting.column_names).not_to include("merge_trains_enabled")
}
end
end
end
......@@ -34,7 +34,7 @@ describe AutoMerge::MergeWhenPipelineSucceedsService do
it { is_expected.to be_truthy }
context 'when the head piipeline succeeded' do
context 'when the head pipeline succeeded' do
let(:pipeline_status) { :success }
it { is_expected.to be_falsy }
......
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