discourse/db/migrate/20140804072504_views_to_topic_views.rb
Sam cb0ecd9ff1 PERF: store topic views in a topic view table
* cut down on storage of the work Topic, 3 times per row (in 2 indexes)
* only store one view per user per topic
* only store one view per ip per topic
2014-08-04 19:07:55 +10:00

11 lines
290 B
Ruby

class ViewsToTopicViews < ActiveRecord::Migration
def change
remove_column :views, :parent_type
rename_column :views, :parent_id, :topic_id
rename_table :views, :topic_views
add_index :topic_views, [:topic_id]
add_index :topic_views, [:user_id, :topic_id]
end
end