Home
Contributing
Guidelines
Database Schema
Database Schema
On this page
Table Names#
Should match in every database implementation.
Should be all lower case.
Should use singular form (i.e. not plural).
Should use the underscore character (_
) between words.
Should only contain alphanumeric characters and the underscore character (_
).
The underscore character (_
):
Should always be used between words.
Should only be used:
Between words.
As a prefix for temporary tables.
Should start and end with only an alphabetic character, excluding specific exceptions mentioned elsewhere with
prefix and suffix terminology.
Column Names#
Should match in every database implementation.
Should be all lower case.
Should only contain alphanumeric characters and the underscore character (_
).
The underscore character (_
):
Should always be used between words.
Should only be used between words.
Should only start and end with an alphabetic character.
Key Names#
Foreign Keys#
Format: <table_name>_<column_name>_fkey
Where:
The table name is the name of the table the foreign key exists on.
The column name is the name of the column the foreign key is for.
Unique Keys#
Format: <table_name>_<key_name>_key
Where:
The table name is the name of the table the unique key is on.
The key name is the name to describe this key. This can also be the column name it exists on.
Primary Keys#
Most database engines don’t allow customizing the primary key names. As such the primary key should not be explicitly
set except to change it back to the default format.