/
[database] Database field naming ideas

[database] Database field naming ideas

Imported From: http://groups.google.com/group/in-portal-dev/browse_thread/thread/241a5f6370ded07c#

Database is one thing In-Portal can't live without. That's why it's important to keep it as clean and understandable as possible, especially during times, when we constantly adding/removing fields/tables from it.

Recently I needed to search for "Type" field I added to one of the tables. I was very surprised to find, that a lot of database tables share exactly same field name resulting in a lot of results and no way to automatically find all needed usages.

Right now we use pascal case scheme in naming tables and fields in database, e.g.

  • Users
  • UserCustomFields
  • PortalUserId
  • Username

This works perfectly, but for fields with more general names, like "Type", "Status" and so on I'm proposing to add something specific to identify connecting with corresponding database table.

For example:

  • Type for users will become UserType
  • Type for orders will become OrderType

Following this logic CreatedById field should be renamed to OrderCreatedById, AffiliateCreatedById and so on, but I'm not sure this is good idea, since we don't rename or refactor these fields that much.