Nessuna descrizione http://j1x-huginn.herokuapp.com

20131227000021_add_cached_dates_to_agent.rb 600B

    class AddCachedDatesToAgent < ActiveRecord::Migration def up add_column :agents, :last_event_at, :datetime execute "UPDATE agents SET last_event_at = (SELECT created_at FROM events WHERE events.agent_id = agents.id ORDER BY id DESC LIMIT 1)" add_column :agents, :last_error_log_at, :datetime execute "UPDATE agents SET last_error_log_at = (SELECT created_at FROM agent_logs WHERE agent_logs.agent_id = agents.id AND agent_logs.level >= 4 ORDER BY id DESC LIMIT 1)" end def down remove_column :agents, :last_event_at remove_column :agents, :last_error_log_at end end