Commit 05c4cfe1 authored by Peter Leitzen's avatar Peter Leitzen Committed by Rémy Coutable

Resolve "Remove unused `users.support_bot`"

parent 9bd2f7c6
......@@ -470,7 +470,7 @@ tables:
- ghost
- last_activity_on
- notified_of_own_activity
- support_bot
- bot_type
- preferred_language
- theme_id
......@@ -3289,7 +3289,6 @@ ActiveRecord::Schema.define(version: 20190530154715) do
t.boolean "ghost"
t.date "last_activity_on"
t.boolean "notified_of_own_activity"
t.boolean "support_bot"
t.string "preferred_language"
t.boolean "email_opted_in"
t.string "email_opted_in_ip"
......@@ -3322,8 +3321,6 @@ ActiveRecord::Schema.define(version: 20190530154715) do
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
t.index ["state"], name: "index_users_on_state", using: :btree
t.index ["state"], name: "index_users_on_state_and_internal", where: "((ghost <> true) AND (bot_type IS NULL))", using: :btree
t.index ["state"], name: "index_users_on_state_and_internal_attrs", where: "((ghost <> true) AND (support_bot <> true))", using: :btree
t.index ["support_bot"], name: "index_users_on_support_bot", using: :btree
t.index ["username"], name: "index_users_on_username", using: :btree
t.index ["username"], name: "index_users_on_username_trigram", using: :gin, opclasses: {"username"=>"gin_trgm_ops"}
end
......
......@@ -269,7 +269,10 @@ module EE
end
def bot?
has_bot_type? ? bot_type.present? : old_support_bot
return bot_type.present? if has_attribute?(:bot_type)
# Some older *migration* specs utilize this removed column
read_attribute(:support_bot)
end
protected
......@@ -283,14 +286,6 @@ module EE
private
def has_bot_type?
has_attribute?(:bot_type)
end
def old_support_bot
read_attribute(:support_bot)
end
def namespace_union(select = :id)
::Gitlab::SQL::Union.new([
::Namespace.select(select).where(type: nil, owner: self),
......
# frozen_string_literal: true
class RemoveUsersSupportType < ActiveRecord::Migration[5.1]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_STATE_INTERNAL_ATTRS = 'index_users_on_state_and_internal_attrs'
disable_ddl_transaction!
def up
remove_concurrent_index :users, :state, name: INDEX_STATE_INTERNAL_ATTRS
remove_concurrent_index :users, :support_bot
remove_column :users, :support_bot
end
def down
add_column :users, :support_bot, :boolean
add_concurrent_index :users, :support_bot
add_concurrent_index :users, :state,
name: INDEX_STATE_INTERNAL_ATTRS,
where: 'ghost <> true AND support_bot <> true'
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