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
_______________________________________________
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/dbix-class@lists.rawmode.org/