This repository has been archived on 2020-05-27. You can view files and clone it, but cannot push or open issues/pull-requests.
binaryattraction/schema/migrations/006_cached_vote_fields_migr...

16 lines
499 B
Ruby
Raw Normal View History

class CachedVoteFieldsMigration < ActiveRecord::Migration
def self.up
add_column :photos, :votes_count, :integer, :default => 0
add_column :photos, :one_votes, :integer, :default => 0
add_column :photos, :zero_votes, :integer, :default => 0
add_column :photos, :oneness, :float, :precision => 1
end
def self.down
remove_column :photos, :votes_count
remove_column :photos, :one_votes
remove_column :photos, :zero_votes
remove_column :photos, :oneness
end
end