Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Temporal model - What changed between revisions?
  • I was just reading the documentation on the new temporal models and I while I think its great that you can store different versions of rows..but what I'd really like to know is what changed between two versions of a record.

    Are there any plans to implement such functionality or does it already exist? Is this down to the developer to implement?

    Something like this would be incredibly useful for audit logs.

    Cheers,
  • Afaik that is not currently implemented.
  • Does that imply that it will one day be?
  • The Orm will be rewritten for Fuel v2, which will have a lot more flexible architecture.

    Just discussed it with Steve (who's doing ORM), and he doesn't see it at as very difficult to implement.
  • Hi,

    about temporal model, a great feature would be to consider that the new revision is not immediately considered as validated. It would allow the possibility to create "draft" revision which don't invalidate the production revision.
  • In temporal, every revision is "valid", or in other words, there is no validation status. It works based on timestamps (valid-from - valid-to), and if you don't select anything, you'll get the record where the valid-to is null.

    This system is mainly used for data that varies with time, such as product or price information, negotiated discounts, and so on.

    It is not meant for revisions (with a possible valid/draft/etc status). That might be worth looking at for the new Orm though. I'll pass it on to Steve.
  • Indeed the current temporal model is not designed to work in the way that you describe. Potentially you could abuse the current soft delete functionality of model_soft. You could create your initial data then "delete" it right away. This could be your flag for a draft then when ready the entity could be restored to mark it as "valid"
  • indeed, soft delete could be a solution, but only for creation.
    Typical case is we have an object and its relations, somebody want to modify some stuffs, ask a validation, somebody else validates and then the current object is replaced.
    I searched in every directions, but my skills are too limited : I always finish doing a full copy of the object and tag it as a draft while it's not validated.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion