Database Naming Conventions
Goals
The scope of this document is to propose a naming convention for the database schema. The main objectives are:
- Ensure portability of Mifos database code to different operating systems. Namely, Linux, Windows, and Mac OS X.
- Encourage intuitive naming of database identifiers like tables and columns.
- Improve readability and maintainability of database code.
Portability to databases other than MySQL is out of scope of this document.
Constraints for all identifiers
- Allowed characters for identifiers are a-z, 0-9, and _.
- All identifiers shall be in English.
- Underscores should be used to separate words, e.g.
account_name
. - 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.
Identifier Type |
Max length (characters) |
Example |
---|---|---|
database/schema |
64 |
|
table |
64 |
|
column |
64 |
|
index |
64 |
|
view |
64 |
|
alias |
255 |
|