Sha256: 06ceb6499c79ab6f2a6d1366bee1bf3c2a0ef8d6fe64f634e57660f05f0d64c4

Contents?: true

Size: 653 Bytes

Versions: 16

Compression:

Stored size: 653 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 null: true
    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

16 entries across 16 versions & 1 rubygems

Version Path
dm_core-4.2.3.10 db/migrate/20140105133446_acts_as_votable_migration.rb
dm_core-4.2.3.9 db/migrate/20140105133446_acts_as_votable_migration.rb
dm_core-4.2.3.8 db/migrate/20140105133446_acts_as_votable_migration.rb
dm_core-4.2.3.7 db/migrate/20140105133446_acts_as_votable_migration.rb
dm_core-4.2.3.6 db/migrate/20140105133446_acts_as_votable_migration.rb
dm_core-4.2.3.5 db/migrate/20140105133446_acts_as_votable_migration.rb
dm_core-4.2.3.4 db/migrate/20140105133446_acts_as_votable_migration.rb
dm_core-4.2.3.3 db/migrate/20140105133446_acts_as_votable_migration.rb
dm_core-4.2.3.2 db/migrate/20140105133446_acts_as_votable_migration.rb
dm_core-4.2.3.1 db/migrate/20140105133446_acts_as_votable_migration.rb
dm_core-4.2.3 db/migrate/20140105133446_acts_as_votable_migration.rb
dm_core-4.2.2.3 db/migrate/20140105133446_acts_as_votable_migration.rb
dm_core-4.2.2.2 db/migrate/20140105133446_acts_as_votable_migration.rb
dm_core-4.2.2.1 db/migrate/20140105133446_acts_as_votable_migration.rb
dm_core-4.2.2 db/migrate/20140105133446_acts_as_votable_migration.rb
dm_core-4.2.1.5 db/migrate/20140105133446_acts_as_votable_migration.rb