Commit 4667b20c authored by Alexis Reigel's avatar Alexis Reigel

add trigram database index on tags

parent 022ee0c0
# frozen_string_literal: true
class AddIndexToTags < ActiveRecord::Migration[5.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'index_tags_on_name_trigram'
disable_ddl_transaction!
def up
add_concurrent_index :tags, :name, name: INDEX_NAME, using: :gin, opclasses: { name: :gin_trgm_ops }
end
def down
remove_concurrent_index_by_name(:tags, INDEX_NAME)
end
end
...@@ -2053,6 +2053,7 @@ ActiveRecord::Schema.define(version: 20190220150130) do ...@@ -2053,6 +2053,7 @@ ActiveRecord::Schema.define(version: 20190220150130) do
t.string "name" t.string "name"
t.integer "taggings_count", default: 0 t.integer "taggings_count", default: 0
t.index ["name"], name: "index_tags_on_name", unique: true, using: :btree t.index ["name"], name: "index_tags_on_name", unique: true, using: :btree
t.index ["name"], name: "index_tags_on_name_trigram", using: :gin, opclasses: {"name"=>"gin_trgm_ops"}
end end
create_table "term_agreements", force: :cascade do |t| create_table "term_agreements", force: :cascade do |t|
......
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