Skip to content

replace the property attribute_deltas array with hash in events

Compare
Choose a tag to compare
@hallgren hallgren released this 25 May 11:09
· 29 commits to master since this release

The new event structure

:aggregate_type => "SandthornProduct",
:aggregate_version => 1,
:aggregate_id => "da932773-dd06-43dc-8c0c-61837f009226",
:sequence_number => 1,
:event_name => "new",
:timestamp => "2014-04-08 12:22:09 UTC",
:event_data => {
  :name => {
    :old_value => "the old value",
    :new_value => "the new value"
  },
  :price => {
    :old_value => "the old value",
    :new_value => "the new value"
  }
}

where the change is in the :event_data. The old structure looked like this and are no longer valid

:event_data => {
  :attribute_deltas => [
    {
      :attribute_name => "name",
      :old_value => null,
      :new_value => "Morgan"},
    {
      :attribute_name => "price",
      :old_value => null,
      :new_value => "Morgan"
    }
  ]
}

The reason for the change is that its now easier to access the properties in the event_data via a key. Before the attribute_deltas had to be iterated one by one to find the property of interest.