canvas-lms/db/migrate/20111017165221_turnitin_fix.rb

19 lines
532 B
Ruby

class TurnitinFix < ActiveRecord::Migration
tag :predeploy
def self.up
Assignment.record_timestamps = false
Assignment.where("turnitin_enabled AND EXISTS (?)",
Submission.where("assignment_id = assignments.id AND turnitin_data IS NOT NULL")).
find_each do |assignment|
assignment.turnitin_settings = assignment.turnitin_settings
assignment.turnitin_settings[:created] = true
assignment.save
end
Assignment.record_timestamps = true
end
def self.down
end
end