[Catalyst] Maintaining updated and created timestamps in database

Brandon Black blblack at gmail.com
Thu Mar 2 15:23:38 CET 2006


On 3/2/06, hkclark at gmail.com <hkclark at gmail.com> wrote:
> 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).
>

MySQL and PostgreSQL are just as well supported by Catalyst and the
various ORM models (DBIx::Class, Class::DBI) as SQLite, and you
shouldn't have any issues using them in place of SQLite.

SQLite can be easier to work with because it's easier to set up, but
it will fall short on features.  MySQL and PostgreSQL may take a
little more work to get the database up and running (installing
packages, initializing the database somewhere, etc), but you can
follow their specific docs for that.  No matter which of the three you
use, once you have a database created (which is a task external to
Catalyst), using them from Catalyst should be virtually identical.

-- Brandon



More information about the Catalyst mailing list