1.9 KiB
1.9 KiB
title | description | lead | date | draft | images | menu | weight | toc | aliases | ||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Database Schema | Authelia Development Database Schema Guidelines | This section covers the database schema guidelines we use for development. | 2022-11-09T09:20:18+11:00 | false |
|
320 | true |
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.
- The underscore character (
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.
- The underscore 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.