adds cache columns to acs_as_votable models

This commit is contained in:
Juanjo Bazán
2015-08-25 15:58:23 +02:00
parent 6bfe369e7d
commit 96dc85d1a5
3 changed files with 68 additions and 2 deletions

View File

@@ -0,0 +1,19 @@
class AddsVotableCacheFieldToComments < ActiveRecord::Migration
def change
add_column :comments, :cached_votes_total, :integer, default: 0
add_column :comments, :cached_votes_score, :integer, default: 0
add_column :comments, :cached_votes_up, :integer, default: 0
add_column :comments, :cached_votes_down, :integer, default: 0
add_column :comments, :cached_weighted_score, :integer, default: 0
add_column :comments, :cached_weighted_total, :integer, default: 0
add_column :comments, :cached_weighted_average, :float, default: 0
add_index :comments, :cached_votes_total
add_index :comments, :cached_votes_score
add_index :comments, :cached_votes_up
add_index :comments, :cached_votes_down
add_index :comments, :cached_weighted_score
add_index :comments, :cached_weighted_total
add_index :comments, :cached_weighted_average
end
end

View File

@@ -0,0 +1,19 @@
class AddsVotableCacheFieldToDebates < ActiveRecord::Migration
def change
add_column :debates, :cached_votes_total, :integer, default: 0
add_column :debates, :cached_votes_score, :integer, default: 0
add_column :debates, :cached_votes_up, :integer, default: 0
add_column :debates, :cached_votes_down, :integer, default: 0
add_column :debates, :cached_weighted_score, :integer, default: 0
add_column :debates, :cached_weighted_total, :integer, default: 0
add_column :debates, :cached_weighted_average, :float, default: 0
add_index :debates, :cached_votes_total
add_index :debates, :cached_votes_score
add_index :debates, :cached_votes_up
add_index :debates, :cached_votes_down
add_index :debates, :cached_weighted_score
add_index :debates, :cached_weighted_total
add_index :debates, :cached_weighted_average
end
end