ref: master
vendor/plugins/kandadaboggu-vote_fu/generators/vote_fu/templates/migration.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
class VoteFuMigration < ActiveRecord::Migration def self.up create_table :votes, :force => true do |t| t.integer :vote, :null => false t.references :voteable, :polymorphic => true, :null => false t.references :voter, :polymorphic => true t.timestamps end add_index :votes, ["voter_id", "voter_type"], :name => "fk_voters" add_index :votes, ["voteable_id", "voteable_type"], :name => "fk_voteables" # If you want to enfore "One Person, One Vote" rules in the database, uncomment the index below # add_index :votes, ["voter_id", "voter_type", "voteable_id", "voteable_type"], :unique => true, :name => "uniq_one_vote_only" end def self.down drop_table :votes end end |