making a timestamp on record insertion

Topics: Writing modules
Mar 9, 2012 at 4:40 PM

I'm trying to figure out how, in the migration, make the equivalent of  'now()' timestamp when a record is created.  

I've tried using the .WithDefault(DateTime.UtcNow) but that hard-codes the column to whatever 'UtcNow' is at the time the migration was run, not the time of record creation.

Its not an option to set the value in the part, because the part has a relation with the user, so when a user is created, the part's record is also automatically created.

Mar 9, 2012 at 8:47 PM

I don;t think this option exists today. File a suggestion in the issue tracker if you want.

Mar 9, 2012 at 8:54 PM

Make a property in your record named Version, of type int, and it will get incremented automatically when updated.