class QG < ActiveRecord::Base
  set_table_name 'question_groups' 
end

class UpdateBlankApiIdsOnQuestionGroup < ActiveRecord::Migration
  def self.up
    QG.where('api_id IS ?', nil).each do |qg|
      qg.api_id = Surveyor::Common.generate_api_id
      qg.save!
    end
  end

  def self.down
  end
end

class Survey < ActiveRecord::Base; end
class Question < ActiveRecord::Base; end
class QuestionGroup < ActiveRecord::Base; end
class Answer < ActiveRecord::Base; end
class Response < ActiveRecord::Base; end
class ResponseSet < ActiveRecord::Base; end

class UpdateBlankApiIdsOnQuestionGroup < ActiveRecord::Migration
  def self.up
    check = [Survey, Question, QuestionGroup, Answer, Response, ResponseSet]
    check.each do |clazz|
      clazz.where('api_id IS ?', nil).each do |c|
        c.api_id = Surveyor::Common.generate_api_id
        c.save!
      end
    end
  end

  def self.down
  end
end

Add survey, question, answer, response, and response set to migration that adds uuids for rows missing that.
Add survey, question, answer, response, and response set to migration that adds uuids for rows missing that.
