Reputation: 409
I want to track changes in laravel 5.3 using sofa/revisionable package (or any other package which performs same action)
Tables are as follows:
item
id - primary key
title - text
item_fields
id - primary key
title - name of the field
item_field_values
item_id - foreign key to item(id)
field_id - foreign key to item_fields(id)
value - text
Example
item
1 - "John"
item_fields
1 - "email"
2 - "last login time"
3 - "balance"
item_values
1 - 1 - "[email protected]" // email
1 - 2 - "01.11.2016 11:30:03" // last login time
1 - 3 - "$38" // balance
For example, user's balance changes at the same time as user's logon, so revisions table would contain something like this
"For user 1 last login time changed from 01.11.2016 11:30.03 to 02.11.2016 10:20:00"
"For user 1 balance changed from $38 to $36.50"
These are two separate fields, not related to each other. If I want to show them as one change
, but not different changes, I can not make this, because these fields have no links to each other.
Another example, new row is added to revisions table
"For user 1 balance changed from $36.5 to $33"
It is one diff.
How can I select related changes from different fields as one bulk revision? There will be lots of item_fields (hundreds). I can not rely on created
time of rows in revisions
table.
Problem with all revisions related packages in laravel is that they track changes to all fields in one model, but in my case there is one model (item_field_values), but one revision/version can contain many changed rows.
Upvotes: 0
Views: 435