Home > Developers > Wiki > Database Naming Conventions
Views


Goals

The scope of this document is to propose a naming convention for the database schema. The main objectives are:

  1. Ensure portability of Mifos database code to different operating systems. Namely, Linux, Windows, and Mac OS X.
  2. Encourage intuitive naming of database identifiers like tables and columns.
  3. Improve readability and maintainability of database code.

Portability to databases other than MySQL is out of scope of this document.

Constraints for All Identifiers

  1. Allowed characters for identifiers are a-z, A-Z, 0-9, and _.
  2. All identifiers shall be in English.
  3. Underscores should be used to separate words, e.g. account_name.
  4. Do not use commonly reserved database keywords like table, column, index, etc.

Identifier Types

In addition to the constraints above, particular database identifier types have additional constraints. Maximum lengths were initially derived from the MySQL manual. While some of these restrictions are not mandatory, following them to the letter will help ensure database portability.

Database

case:lower
maxlength:64 characters
example:mifos

Table

case:lower (mandatory)
maxlength:64 characters
example:customer_transactions

Column

case:lower
maxlength:64 characters
example:transaction_date

Index

case:lower
maxlength:64 characters
example:cust_hierarchy_idx

View

case:lower
maxlength:64 characters
example:customer_loan_view

Alias

case:lower
maxlength:255 characters
example:


Grameen logo