class AddPublishToAttachments < ActiveRecord::Migration
  def change
    add_column :attachments, :is_publish, :integer, :default => 1
    add_column :attachments, :publish_time, :date
=begin
    count = Attachment.all.count / 30 + 2
    transaction do
      for i in 1 ... count do i
        Attachment.page(i).per(30).each do |atta|
          begin
            atta.publish_time = atta.created_on.strftime('%d-%b-%Y')
            atta.save
          ensure
            logger.error("===================>>container_id is null")
          end
        end
      end
    end
=end
  end
end