Sunday, August 24, 2008

SQL Server 2008 and active records

Some important things to know when working with Active records and SQL Server :

1. The ID field has Integer as default data type

2. The ID field is automatically created with an Identity specification with the following values :
- Identity Increment 1
- Identity Seed 1

3. The created_at field does not get a default value (eg. Getdate() would have been nice !). Thus if you don't rely exclusively on the active record to populate this field, it is recommended to add this default value.

4. The updated_at field does get the same value as created_at first. It is then updated while created_at remains unchanged.

No comments: