Adding database index on full-text search for better performance.
This commit is contained in:
parent
d1d4cea63a
commit
110cd16d6e
2 changed files with 12 additions and 1 deletions
11
db/migrate/20130808195123_add_search_index_to_packages.rb
Normal file
11
db/migrate/20130808195123_add_search_index_to_packages.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
class AddSearchIndexToPackages < ActiveRecord::Migration
|
||||
def up
|
||||
execute "create index packages_name on packages using gin(to_tsvector('english', name))"
|
||||
execute "create index packages_description on packages using gin(to_tsvector('english', description))"
|
||||
end
|
||||
|
||||
def down
|
||||
execute "drop index packages_name"
|
||||
execute "drop index packages_description"
|
||||
end
|
||||
end
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20130727112955) do
|
||||
ActiveRecord::Schema.define(version: 20130808195123) do
|
||||
|
||||
create_table "admins", force: true do |t|
|
||||
t.string "username", limit: 20
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue