lib/generators/searchjoy/templates/install.rb in searchjoy-0.3.1 vs lib/generators/searchjoy/templates/install.rb in searchjoy-0.3.2
- old
+ new
@@ -1,20 +1,18 @@
class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version %>
def change
create_table :searchjoy_searches do |t|
- t.integer :user_id
+ t.references :user
t.string :search_type
t.string :query
t.string :normalized_query
t.integer :results_count
t.timestamp :created_at
- t.integer :convertable_id
- t.string :convertable_type
+ t.references :convertable, polymorphic: true
t.timestamp :converted_at
end
add_index :searchjoy_searches, [:created_at]
add_index :searchjoy_searches, [:search_type, :created_at]
- add_index :searchjoy_searches, [:search_type, :normalized_query, :created_at], name: "index_searchjoy_searches_on_search_type_normalized_query" # autogenerated name is too long
- add_index :searchjoy_searches, [:convertable_id, :convertable_type]
+ add_index :searchjoy_searches, [:search_type, :normalized_query, :created_at], name: "index_searchjoy_searches_on_search_type_query" # autogenerated name is too long
end
end