迁移调整

dev_forge
cxt 6 years ago
parent 27916c5d4e
commit d4fa1b1100

@ -1,8 +1,6 @@
class AddIndexToPollAnswer < ActiveRecord::Migration[5.2] class AddIndexToPollAnswer < ActiveRecord::Migration[5.2]
def change def change
remove_index :poll_votes, :poll_question_id remove_index :poll_votes, column: [:poll_question_id, :user_id]
remove_index :poll_votes, :user_id
remove_index :poll_votes, :poll_answer_id
change_column_default :poll_votes, :poll_question_id, from: nil, to: -1 change_column_default :poll_votes, :poll_question_id, from: nil, to: -1
PollVote.where(poll_answer_id: nil).update_all(poll_answer_id: -1) PollVote.where(poll_answer_id: nil).update_all(poll_answer_id: -1)

Loading…
Cancel
Save