diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20190919183411_add_index_packages_on_name_trigram_to_packages_packages.rb | 18 | ||||
-rw-r--r-- | db/schema.rb | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20190919183411_add_index_packages_on_name_trigram_to_packages_packages.rb b/db/migrate/20190919183411_add_index_packages_on_name_trigram_to_packages_packages.rb new file mode 100644 index 00000000000..d359350a891 --- /dev/null +++ b/db/migrate/20190919183411_add_index_packages_on_name_trigram_to_packages_packages.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexPackagesOnNameTrigramToPackagesPackages < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_packages_packages_on_name_trigram' + + disable_ddl_transaction! + + def up + add_concurrent_index :packages_packages, :name, name: INDEX_NAME, using: :gin, opclass: { name: :gin_trgm_ops } + end + + def down + remove_concurrent_index_by_name(:packages_packages, INDEX_NAME) + end +end diff --git a/db/schema.rb b/db/schema.rb index 4ca75ece3f9..b2caca12ce4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2556,6 +2556,7 @@ ActiveRecord::Schema.define(version: 2019_09_27_074328) do t.string "name", null: false t.string "version" t.integer "package_type", limit: 2, null: false + t.index ["name"], name: "index_packages_packages_on_name_trigram", opclass: :gin_trgm_ops, using: :gin t.index ["project_id"], name: "index_packages_packages_on_project_id" end |