canvas-lms/db/migrate/20120104183918_fix_sis_comm...

15 lines
436 B
Ruby
Raw Normal View History

class FixSisCommunicationChannels < ActiveRecord::Migration
disable_ddl_transaction!
def self.up
begin
pseudonym_ids = Pseudonym.joins(:sis_communication_channel).where("pseudonyms.user_id<>communication_channels.user_id").limit(1000).pluck(:id)
Pseudonym.where(:id => pseudonym_ids).update_all(:sis_communication_channel_id => nil)
sleep 1
end until pseudonym_ids.empty?
end
def self.down
end
end