lib/fuzzily/migration.rb in fuzzily-0.2.0 vs lib/fuzzily/migration.rb in fuzzily-0.2.1
- old
+ new
@@ -19,14 +19,15 @@
t.integer :owner_id
t.string :owner_type
t.string :fuzzy_field
end
+ # owner_id goes first as we'll GROUP BY that
add_index trigrams_table_name,
- [:owner_type, :fuzzy_field, :trigram, :owner_id, :score],
+ [:owner_id, :owner_type, :fuzzy_field, :trigram, :score],
:name => :index_for_match
add_index trigrams_table_name,
- [:owner_type, :owner_id],
+ [:owner_id, :owner_type],
:name => :index_by_owner
end
def down
drop_table trigrams_table_name