adds only the needed cahced fields to comments and debates;

This commit is contained in:
kikito
2015-08-26 14:46:51 +02:00
parent 6ead1a2c1d
commit c9ca3877e8
3 changed files with 2 additions and 34 deletions

View File

@@ -1,19 +1,11 @@
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

@@ -1,19 +1,11 @@
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
end