Commit 7d08cc22 authored by Andreas Brandl's avatar Andreas Brandl

Merge branch '34636-drop-deprecated-column-from-projects-table' into 'master'

Drop deprecated column from projects

Closes #34636

See merge request gitlab-org/gitlab!18914
parents f035deba 5bf6b2ec
---
title: Drop deprecated column from projects table
merge_request: 18914
author:
type: deprecated
# frozen_string_literal: true
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class DropMergeRequestsRequireCodeOwnerApprovalFromProjects < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
remove_column :projects, :merge_requests_require_code_owner_approval, :boolean
end
def down
add_column :projects, :merge_requests_require_code_owner_approval, :boolean
add_concurrent_index(
:projects,
%i[archived pending_delete merge_requests_require_code_owner_approval],
name: 'projects_requiring_code_owner_approval',
where: '((pending_delete = false) AND (archived = false) AND (merge_requests_require_code_owner_approval = true))'
)
end
end
......@@ -3186,7 +3186,6 @@ ActiveRecord::Schema.define(version: 2019_11_18_182722) do
t.bigint "pool_repository_id"
t.string "runners_token_encrypted"
t.string "bfg_object_map"
t.boolean "merge_requests_require_code_owner_approval"
t.boolean "detected_repository_languages"
t.boolean "merge_requests_disable_committers_approval"
t.boolean "require_password_to_approve"
......@@ -3198,7 +3197,6 @@ ActiveRecord::Schema.define(version: 2019_11_18_182722) do
t.date "marked_for_deletion_at"
t.integer "marked_for_deletion_by_user_id"
t.index "lower((name)::text)", name: "index_projects_on_lower_name"
t.index ["archived", "pending_delete", "merge_requests_require_code_owner_approval"], name: "projects_requiring_code_owner_approval", where: "((pending_delete = false) AND (archived = false) AND (merge_requests_require_code_owner_approval = true))"
t.index ["created_at", "id"], name: "index_projects_on_created_at_and_id"
t.index ["creator_id"], name: "index_projects_on_creator_id"
t.index ["description"], name: "index_projects_on_description_trigram", opclass: :gin_trgm_ops, using: :gin
......
# frozen_string_literal: true
require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20191015154408_drop_merge_requests_require_code_owner_approval_from_projects.rb')
describe DropMergeRequestsRequireCodeOwnerApprovalFromProjects, :migration do
let(:projects_table) { table(:projects) }
subject(:migration) { described_class.new }
describe "without running the migration" do
it "project_table has a :merge_requests_require_code_owner_approval column" do
expect(projects_table.column_names)
.to include("merge_requests_require_code_owner_approval")
end
it "project_table has a :projects_requiring_code_owner_approval index" do
expect(ActiveRecord::Base.connection.indexes(:projects).collect(&:name))
.to include("projects_requiring_code_owner_approval")
end
end
describe '#up' do
context "without running "
before do
migrate!
end
it "drops the :merge_requests_require_code_owner_approval column" do
expect(projects_table.column_names)
.not_to include("merge_requests_require_code_owner_approval")
end
it "drops the :projects_requiring_code_owner_approval index" do
expect(ActiveRecord::Base.connection.indexes(:projects).collect(&:name))
.not_to include("projects_requiring_code_owner_approval")
end
end
describe "#down" do
before do
migration.up
migration.down
end
it "project_table has a :merge_requests_require_code_owner_approval column" do
expect(projects_table.column_names)
.to include("merge_requests_require_code_owner_approval")
end
it "project_table has a :projects_requiring_code_owner_approval index" do
expect(ActiveRecord::Base.connection.indexes(:projects).collect(&:name))
.to include("projects_requiring_code_owner_approval")
end
end
end
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