From 8333673b62322a61189f282968ed058ac34335d6 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Tue, 17 Jan 2017 15:31:22 -0800 Subject: [PATCH] add trigram index to user names --- db/migrate/20170117233040_add_trigram_index_to_users.rb | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 db/migrate/20170117233040_add_trigram_index_to_users.rb diff --git a/db/migrate/20170117233040_add_trigram_index_to_users.rb b/db/migrate/20170117233040_add_trigram_index_to_users.rb new file mode 100644 index 000000000..4972e16ab --- /dev/null +++ b/db/migrate/20170117233040_add_trigram_index_to_users.rb @@ -0,0 +1,6 @@ +class AddTrigramIndexToUsers < ActiveRecord::Migration + def change + execute "set statement_timeout = 0" + execute "create index index_users_on_name_trgm on users using gin (lower(name) gin_trgm_ops)" + end +end