Merge branch '14070-name-index'
authorTom Clegg <tom@curii.com>
Mon, 24 Apr 2023 15:24:16 +0000 (11:24 -0400)
committerTom Clegg <tom@curii.com>
Mon, 24 Apr 2023 15:24:16 +0000 (11:24 -0400)
fixes #14070

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

services/api/db/migrate/20230421142716_add_name_index_to_collections_and_groups.rb [new file with mode: 0644]
services/api/db/structure.sql

diff --git a/services/api/db/migrate/20230421142716_add_name_index_to_collections_and_groups.rb b/services/api/db/migrate/20230421142716_add_name_index_to_collections_and_groups.rb
new file mode 100644 (file)
index 0000000..5fe450d
--- /dev/null
@@ -0,0 +1,14 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+class AddNameIndexToCollectionsAndGroups < ActiveRecord::Migration[5.2]
+  def up
+    ActiveRecord::Base.connection.execute 'CREATE INDEX index_groups_on_name on groups USING gin (name gin_trgm_ops)'
+    ActiveRecord::Base.connection.execute 'CREATE INDEX index_collections_on_name on collections USING gin (name gin_trgm_ops)'
+  end
+  def down
+    ActiveRecord::Base.connection.execute 'DROP INDEX index_collections_on_name'
+    ActiveRecord::Base.connection.execute 'DROP INDEX index_groups_on_name'
+  end
+end
index 002b470b120c81fd100b86d701496826cc074eda..3dd705a801a8f29040da1b07f4fa0a3d45527c29 100644 (file)
@@ -1942,6 +1942,13 @@ CREATE INDEX index_collections_on_is_trashed ON public.collections USING btree (
 CREATE INDEX index_collections_on_modified_at_and_uuid ON public.collections USING btree (modified_at, uuid);
 
 
+--
+-- Name: index_collections_on_name; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_collections_on_name ON public.collections USING gin (name public.gin_trgm_ops);
+
+
 --
 -- Name: index_collections_on_owner_uuid; Type: INDEX; Schema: public; Owner: -
 --
@@ -2131,6 +2138,13 @@ CREATE INDEX index_groups_on_is_trashed ON public.groups USING btree (is_trashed
 CREATE INDEX index_groups_on_modified_at_and_uuid ON public.groups USING btree (modified_at, uuid);
 
 
+--
+-- Name: index_groups_on_name; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_groups_on_name ON public.groups USING gin (name public.gin_trgm_ops);
+
+
 --
 -- Name: index_groups_on_owner_uuid; Type: INDEX; Schema: public; Owner: -
 --
@@ -3187,6 +3201,7 @@ INSERT INTO "schema_migrations" (version) VALUES
 ('20220726034131'),
 ('20220804133317'),
 ('20221219165512'),
-('20221230155924');
+('20221230155924'),
+('20230421142716');