[Catalyst] Maintaining updated and created timestamps in database

hkclark at gmail.com hkclark at gmail.com
Thu Mar 2 15:07:24 CET 2006


On 3/2/06, Brandon Black <blblack at gmail.com> wrote:
...
>
> I would try to handle it at the DB level along those kinds of lines if
> it were me.
>
> I don't know anything about doing it in Class::DBI, so I'll leave that
> one alone.
>
> To do it in DBIx::Class will require someone writing a new add-on
> component module for it.  Having it always just happen for columns
> with the magic names created_on and updated_on is probably a Bad Idea
> in the general case, but one could make it so that the new component
> (DBIx::Class::AutoTimestamps or some such thing) would take a new
> setup-time call like __PACKAGE__->auto_timestamp_cols({ create =>
> created_on, update => updated_on }); when the source class is set up.
>
> Writing such a package is left as an exercise for the next guy to read this :)
>
> -- Brandon

Thanks, Brandon.  I should have mentioned that I'm currently working
with SQLite.  I know MySQL a lot better, but it seems that SQLite is
"better supported" with Catalyst (e.g., the MySQL version of the
Scaffolding Movie Demo" at
http://dev.catalyst.perl.org/wiki/ScaffoldingDemoWithDBIxAndMySQL
doesn't work -- see TODO #1 at the bottom of that page).

I don't think it has the ability to update timestamps automatically
like you can do with PostgreSQL and MySQL (it looks like there is some
support for triggers, but I haven't looked into that part of SQLite
yet).

Let me know if anyone has any insights for me on how the dates are
working in EasyCMS... it looks like I want to do pretty much the same
thing.

Thanks!



More information about the Catalyst mailing list