Files
grecia/db/migrate/20150717180105_acts_as_votable_migration.rb
Javi Martín 55addaa58a Apply rubocop rules to migration files
There are some rules which only affect migration files, and we cannot
enable them if we're excluding those files from being inspected.

We're also changing migrations related to the Rails/TimeZone rule
slightly because these fields were already changed afterwards, so we
aren't changing the schema.
2019-10-24 20:35:13 +02:00

22 lines
489 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