These guidelines apply to relational databases, specifically Microsoft SqlServer.
Tables should contain the following:
- Table names should be singular, i.e. Customer, not Customers
- Unique
PRIMARY KEYcolumn that following the naming pattern of {table}Id, i.e. CustomerId. This should be numeric and incrementing, ideally an identity column. - When table will be used in or part of a REST resource, a
uniqueidentiercolumn that has aUNIQUEconstraint on it following the naming pattern of {table}ResourceId, i.e. CustomerResourceId. - Excepting in case of a pure join table, all tables should have a set of audit stamp column for keeping track of when a row was created or last modified
- CreatedDate
- CreateSubjectId
- LastModifiedDate
- LastModifiedSubjectId