Sha256: e0bc620a482738bf686de595e6117ea0d3f5d00b442408f675649dfaeae08d00

Contents?: true

Size: 642 Bytes

Versions: 19

Compression:

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

19 entries across 19 versions & 2 rubygems

Version Path
commontator-5.1.0 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.4 spec/dummy/db/migrate/3_acts_as_votable_migration.rb~
commontator-4.10.3 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.10.2 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.10.1 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.10.0 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.9.0 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
acts_as_votable-0.10.0 lib/generators/acts_as_votable/migration/templates/active_record/migration.rb
acts_as_votable-0.9.0 lib/generators/acts_as_votable/migration/templates/active_record/migration.rb
commontator-4.5.4 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.5.3 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.5.2 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.5.1 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.5.0 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.4.1 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.3.0 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
commontator-4.2.2 spec/dummy/db/migrate/3_acts_as_votable_migration.rb
acts_as_votable-0.8.0 lib/generators/acts_as_votable/migration/templates/active_record/migration.rb