# coding: utf-8
class AddAgentToReports < ActiveRecord::Migration
  def self.up
    add_column :reports, :agent_id, :integer, :default => 1
    add_column :reports, :for_whom_id, :integer
    # 0 - Ринет, 1 - НКС, 2 - ТАС,
    reps = Report.find(:all, :conditions =>"category = '94'")
    Report.update_all("for_whom_id = 2", ["id IN (?)", reps.map(&:id)])
  end
  
  def self.down
    remove_column :reports, :agent_id
    remove_column :reports, :for_whom_id
  end
end
