Sha256: de02767abe502c977ed83dd9f0f0a211134f76b1f139be897687e1d7e9a37b1c
Contents?: true
Size: 537 Bytes
Versions: 13
Compression:
Stored size: 537 Bytes
Contents
class AddQuestionSheetIdInRefs < ActiveRecord::Migration[4.2] def change add_column Fe::ReferenceSheet.table_name, :question_sheet_id, :integer # set initial question_sheet_id on all refs # NOTE: doing an update on a join query is a pain to do in both mysql and postgres # and since there's not that many reference questions, this should be fine Fe::ReferenceQuestion.all.each do |rq| Fe::ReferenceSheet.where(question_id: rq.id).update_all(question_sheet_id: rq.related_question_sheet_id) end end end
Version data entries
13 entries across 13 versions & 1 rubygems