Files
grecia/db/migrate/20150717180105_acts_as_votable_migration.rb
Julian Herrero 65c30c8d2d Remove migrations warning
DEPRECATION WARNING: Directly inheriting from ActiveRecord::Migration
is deprecated. Please specify the Rails release the migration was
written for:

class MigrationClass < ActiveRecord::Migration[4.2]

(called from require at bin/rails:4)
2019-04-17 17:40:56 +02:00

23 lines
490 B
Ruby

class ActsAsVotableMigration < ActiveRecord::Migration[4.2]
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, [:voter_id, :voter_type, :vote_scope]
add_index :votes, [:votable_id, :votable_type, :vote_scope]
end
def self.down
drop_table :votes
end
end