[Dbix-class] applying row level methods via Schema::Loader
Hans Dieter Pearcey
hdp at pobox.com
Wed Jul 4 13:59:56 GMT 2007
On Wed, Jul 04, 2007 at 01:11:01PM +0100, Jess Robinson wrote:
> >Is there a way to get that in all the auto-generated table classes without
> >voodoo? With? Better idea?
> Why not use a field type of TIMESTAMP, which in older mysqls (and in new
> ones if you hit the right config buttons), always auto-fills with current
> date/time when you create a new row.
Definitely do not do this before mysql 4.1.2. In those older mysqls, the first
TIMESTAMP column is updated to now() whenever you update that row. Since 4.1.2
you have more control over it.
Anyway, is there a reason you can't use a DEFAULT? That seems the easiest
thing to me, and protects you in case some other ignorant code needs to insert
into your DB later.
More information about the Dbix-class