docbrown/db/migrate/20190525233934_create_poll_votes.rb
Ben Halpern 8ae057b06e
Beta polls feature (admin use only for now) (#3176)
* Initial poll features

* Add basic poll functionality

* Finish (maybe) beta poll functionality
2019-06-15 17:33:30 -04:00

13 lines
386 B
Ruby

class CreatePollVotes < ActiveRecord::Migration[5.2]
def change
create_table :poll_votes do |t|
t.bigint :user_id, null: false
t.bigint :poll_id, null: false
t.bigint :poll_option_id, null: false
t.timestamps
end
add_index :poll_votes, %i[poll_option_id user_id],
unique: true,
name: "index_poll_votes_on_poll_option_and_user"
end
end