class AssignZoomMeetingsToProjects < ActiveRecord::DataMigration def up ZoomMeeting.find_each do |zm| if zm.respond_to?(:broadcast_id) && zm.broadcast_id.present? broadcast = Broadcast.find_by(id: zm.broadcast_id) if broadcast.present? zm.update_column(:project_id, broadcast.project_id) end end end end def down ZoomMeeting.update_all(project_id: nil) end end