lib/request_log_analyzer/aggregator/database.rb in request-log-analyzer-1.1.4 vs lib/request_log_analyzer/aggregator/database.rb in request-log-analyzer-1.1.5.1

- old
+ new

@@ -94,10 +94,15 @@ # in the corresponding table. This table should already be created before this method is called. def create_activerecord_class(name, definition) class_name = "#{name}_line".camelize klass = Class.new(ActiveRecord::Base) klass.send(:belongs_to, :request) + + definition.captures.each do |capture| + klass.send(:serialize, capture[:name], Hash) if capture[:provides] + end + @orm_module.const_set(class_name, klass) unless @orm_module.const_defined?(class_name) @request_class.send(:has_many, "#{name}_lines".to_sym) end # Creates a requests table, in which a record is created for every request. It also creates an @@ -146,14 +151,23 @@ # Function to determine the column type for a field # TODO: make more robust / include in file-format definition def column_type(type_indicator) case type_indicator - when :eval; :text - when :sec; :double - when :msec; :double - when :float; :double - else type_indicator + when :eval; :text + when :text; :text + when :string; :string + when :sec; :double + when :msec; :double + when :duration; :double + when :float; :double + when :double; :double + when :integer; :integer + when :int; :int + when :timestamp; :datetime + when :datetime; :datetime + when :date; :date + else :string end end end end