[Dbix-class] applying row level methods via Schema::Loader

Jess Robinson castaway at desert-island.me.uk
Wed Jul 4 15:41:28 GMT 2007


On Wed, 4 Jul 2007, Hans Dieter Pearcey wrote:

> 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.
>
> http://dev.mysql.com/doc/refman/4.1/en/timestamp-4-1.html

Oops, I forgot which weirdness was in which version..

> 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.

Perversely, I thought mysql didnt like defaults that were functions? (thus 
the silly timestamp type thing)

Jess




More information about the Dbix-class mailing list