Sha256: cc314a336eeee07f4b1924522fc96fff049a668dc8e5d35ee07973f22199abd5

Contents?: true

Size: 643 Bytes

Versions: 10

Compression:

Stored size: 643 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

    if ActiveRecord::VERSION::MAJOR < 4
      add_index :votes, [:votable_id, :votable_type]
      add_index :votes, [:voter_id, :voter_type]
    end

    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

10 entries across 10 versions & 1 rubygems

Version Path
commontator-4.11.1 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.11.0 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.10.5 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.10.4 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.8.0 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.7.2 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.7.1 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.7.0 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.6.1 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.6.0 spec/dummy/db/migrate/3_acts_as_votable_migration.rb