Sha256: 9e788d96d735ca654b728f7716fe3435fd39a7118e769e3d36c74c67d4a68550

Contents?: true

Size: 589 Bytes

Versions: 4

Compression:

Stored size: 589 Bytes

Contents

class ActsAsVotableMigration < ActiveRecord::Migration
  def self.up
    create_table :votes do |t|

      t.references :votable, :polymorphic => true
      t.references :voter, :polymorphic => true

      t.boolean :vote_flag
      t.string :vote_scope
      t.integer :vote_weight

      t.timestamps
    end

    add_index :votes, [:votable_id, :votable_type]
    add_index :votes, [:voter_id, :voter_type]
    add_index :votes, [:voter_id, :voter_type, :vote_scope]
    add_index :votes, [:votable_id, :votable_type, :vote_scope]
  end

  def self.down
    drop_table :votes
  end
end

Version data entries

4 entries across 2 versions & 1 rubygems

Version Path
translation_center-2.0.2 db/migrate/20130410084605_acts_as_votable_migration.rb
translation_center-2.0.2 spec/dummy/db/migrate/20130410084711_acts_as_votable_migration.translation_center.rb
translation_center-2.0.1 db/migrate/20130410084605_acts_as_votable_migration.rb
translation_center-2.0.1 spec/dummy/db/migrate/20130410084711_acts_as_votable_migration.translation_center.rb