--- apv <[EMAIL PROTECTED]> wrote:

> 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);
> }

I can't comment on this code, but I use a similar
strategy for my revision needs, exceot I use a trigger
at the database level.  I don't bother to do the diffs
since in my case the number of revisions is not very
high (and disk space is cheaper than available CPU
cycles).

If you are expecting lots of revisions per second you
might want to check on the resolution of NOW for you
database.  I usually add a sequence created PK for
extra safety.  --john



> 
> 
> 
> –Ashley
> -- 
> 
> 
> 
> 
> _______________________________________________
> List:
>
http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> Wiki: http://dbix-class.shadowcatsystems.co.uk/
> IRC: irc.perl.org#dbix-class
> SVN:
>
http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
> Searchable Archive:
>
http://www.mail-archive.com/[email protected]/
> 



 
____________________________________________________________________________________
Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to