aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/history.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-08-10 16:05:20 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-08-10 16:05:20 +0100
commita54a32084e9870af6f1ede97887c2332c21e812c (patch)
tree5ccc3afa55e3dc9a9cbb7dedefd0c2d19453ba5c /lib/mauve/history.rb
parent8621a1b4914f70975f83ad59d31da25d5c01aa1a (diff)
Added ability to tag multiple alerts with the same history item.
Diffstat (limited to 'lib/mauve/history.rb')
-rw-r--r--lib/mauve/history.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/mauve/history.rb b/lib/mauve/history.rb
index 1c2cdf4..086fc6d 100644
--- a/lib/mauve/history.rb
+++ b/lib/mauve/history.rb
@@ -3,6 +3,16 @@ require 'mauve/datamapper'
require 'log4r'
module Mauve
+ class AlertHistory
+ include DataMapper::Resource
+
+ property :alert_id, Integer, :key => true
+ property :history_id, Integer, :key => true
+
+ belongs_to :alert
+ belongs_to :history
+ end
+
class History
include DataMapper::Resource
@@ -10,12 +20,12 @@ module Mauve
default_scope(:default).update(:order => [:created_at.desc, :id.desc])
property :id, Serial
- property :alert_id, Integer, :required => true
+# property :alert_id, String, :required => true
property :type, String, :required => true, :default => "unknown"
property :event, Text, :required => true, :default => "Nothing set"
property :created_at, DateTime, :required => true
- belongs_to :alert
+ has n, :alerts, :through => :alerthistory
before :valid?, :set_created_at
@@ -29,4 +39,6 @@ module Mauve
end
+
end
+