[Dbix-class] History/revision/diff strategy

apv apv at sedition.com
Sun Nov 26 06:17:14 GMT 2006


Given a table "article" which has_many "article_history" would this  
be a reasonable approach to keeping track of the history for diffs  
and stuff? Is there a better one? Just store the diff (and apply them  
recursively to roll-back versions)? Is anyone else already doing  
this; share your code?

sub (in article) store_column {
     my ( $self, $name, $value ) = @_;
     if ( $name eq "body" ) {
         $self->add_to_article_history
             ({ body => $value,
                created => \'NOW', #'
            });
     }
     $self->next::method($name, $value);
}



–Ashley
-- 






More information about the Dbix-class mailing list