Merge branch 'sh-remove-import-columns-from-projects' into 'master'

Remove import columns from projects table

See merge request gitlab-org/gitlab-ce!29863
This commit is contained in:
Douwe Maan 2019-06-20 08:31:07 +00:00
commit ef12d7adc4
5 changed files with 22 additions and 8 deletions

View file

@ -55,8 +55,6 @@ class Project < ApplicationRecord
VALID_MIRROR_PORTS = [22, 80, 443].freeze
VALID_MIRROR_PROTOCOLS = %w(http https ssh git).freeze
ignore_column :import_status, :import_jid, :import_error
cache_markdown_field :description, pipeline: :description
delegate :feature_available?, :builds_enabled?, :wiki_enabled?,

View file

@ -0,0 +1,5 @@
---
title: Remove import columns from projects table
merge_request: 29863
author:
type: performance

View file

@ -0,0 +1,14 @@
# frozen_string_literal: true
class RemoveImportColumnsFromProjects < ActiveRecord::Migration[5.1]
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
def change
remove_column :projects, :import_status, :string
remove_column :projects, :import_jid, :string
remove_column :projects, :import_error, :text
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20190613030606) do
ActiveRecord::Schema.define(version: 20190619175843) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -2595,11 +2595,9 @@ ActiveRecord::Schema.define(version: 20190613030606) do
t.integer "visibility_level", default: 0, null: false
t.boolean "archived", default: false, null: false
t.string "avatar"
t.string "import_status"
t.integer "star_count", default: 0, null: false
t.string "import_type"
t.string "import_source"
t.text "import_error"
t.boolean "shared_runners_enabled", default: true, null: false
t.string "runners_token"
t.string "build_coverage_regex"
@ -2621,7 +2619,6 @@ ActiveRecord::Schema.define(version: 20190613030606) do
t.boolean "only_allow_merge_if_all_discussions_are_resolved"
t.boolean "printing_merge_request_link_enabled", default: true, null: false
t.integer "auto_cancel_pending_pipelines", default: 1, null: false
t.string "import_jid"
t.integer "cached_markdown_version"
t.text "delete_error"
t.datetime "last_repository_updated_at"

View file

@ -461,9 +461,9 @@ describe Gitlab::Database::MigrationHelpers do
end
it 'updates all the rows in a table' do
model.update_column_in_batches(:projects, :import_error, 'foo')
model.update_column_in_batches(:projects, :description_html, 'foo')
expect(Project.where(import_error: 'foo').count).to eq(5)
expect(Project.where(description_html: 'foo').count).to eq(5)
end
it 'updates boolean values correctly' do