mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
add top page
This commit is contained in:
23
db/migrate/20131223171005_create_top_topics.rb
Normal file
23
db/migrate/20131223171005_create_top_topics.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
class CreateTopTopics < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :top_topics do |t|
|
||||
t.belongs_to :topic
|
||||
|
||||
TopTopic.periods.each do |period|
|
||||
TopTopic.sort_orders.each do |sort|
|
||||
t.integer "#{period}_#{sort}_count".to_sym, null: false, default: 0
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
add_index :top_topics, :topic_id, unique: true
|
||||
|
||||
TopTopic.periods.each do |period|
|
||||
TopTopic.sort_orders.each do |sort|
|
||||
add_index :top_topics, "#{period}_#{sort}_count".to_sym, order: 'desc'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user