Yep, but is not complete since I would like to handle the rollback from the ID, maybe also need a kind of journal table where it gives a journal_id .. For example, when a use logs-in, you could create a journal record associated with this user etc (name, user_id, date etc ..)... When you want to rollback the modifications of this user you could then find up to where into the histo to rollback data. I also have set a "strict" mode, meaning that if you want to roolback to specific date, but at this date the record did not exists, then you ignore it from the result set ... When applying real rollback, maybe the histo record should be deleted or "flagged" somehow ...
A bit incomplete for now, I also have to check against the latest cake 1.2 .. I do not dare to put that on Bakery since is really "pre Alpha stage" ... On Jan 16, 3:38 pm, Adam Royle <[EMAIL PROTECTED]> wrote: > This sounds pretty cool. Any other drawbacks other than execution > speed and storage space? Are you able to share what you've written? > > On Jan 17, 12:28 am, francky06l <[EMAIL PROTECTED]> wrote: > > > Hi Dave, > > > It's exactly what I have done in a behavior, execpt that I store the > > delta of before/after in it. I have also added in the behavior > > paramtera specific "conditions" that can be used in find/findAll. If > > this condition is set as a date, afterFind will search the table > > "histo table" and find the records create between now and the > > specified date. > > The a "reverse" merge will be applied to "re-create" the record as it > > was for the specified date. > > > However, just storing the delta is quite "consuming" (because it needs > > to evaluate it), also you can sometimes update a record with same > > value, so can be quite hard process. > > Maybe it can be a good start ... > > > On Jan 16, 3:13 pm, Dave J <[EMAIL PROTECTED]> wrote: > > > > Hey guys, I was just thinking about this yesterday. I have by no means > > > done any research on this at all, so... just throwing it out there > > > > What about a journal table (fieldnames: id, model_name, model_id, > > > data)? > > > > And before saving a record with the updated values, you save a > > > serialized array of the existing record values in the journal table? > > > > That way you can view a history of any record, and maybe even use > > > something like phpdiff to see the differences > > > > stupid idea or? > > > > On Jan 16, 2:42 pm, Adam Royle <[EMAIL PROTECTED]> wrote: > > > > > I am also interested in something like this. The tricky thing for me > > > > to understand is how associations would be stored as well. Ideally it > > > > would be great to be able to see a history of models and their > > > > associated models without overwriting the "HEAD" revision. My > > > > reasoning behind this is to have an easy way to implement multiple > > > > drafts of models, without having to rewrite my controllers/views much > > > > (or at all). This functionality could be used in a CMS for preview and > > > > approval functionality. > > > > > On Jan 16, 8:42 pm, francky06l <[EMAIL PROTECTED]> wrote:> Hi bakers, > > > > > > I am wondering if someone already implemented an "historic" or > > > > > "journal" with cake. Actually my need is to be able to keep trac of > > > > > the changes on a record. > > > > > Ideally, each modification would a journal_id and I could roll back > > > > > the journal to restore the data at any points. > > > > > I have been searching the MySql triggers for this, but seems that > > > > > performances are affected a lot. > > > > > I have written a "small" behavior for it, but I am not 100% satisfied > > > > > with this. > > > > > If you have experimented something, I would be glad to know how to > > > > > handle this (maybe another DB is better?). > > > > > > Another question; I haven;t check the code of the 1.2 beta for this : > > > > > is the transactional mode fully implemented or I need a behavior for > > > > > it ? > > > > > > Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
