Conventions of database design
- DB objects (charts, indexes, etc.) of the idm core always have the prefix
idm - DB objects (charts, indexes, etc.) of the module always have the prefix according to the module (e.g.
acc) - DB objects (charts, indexes, etc.) are called in the singular using underscore signs, all in small type (e.g.
idm\_identity\_role) - DB names of objects (charts, indexes, etc.) must be of a maximum of 30 characters (compliance with the limitations of some databases). As for the charts with an audit, you need to bear in mind that a chart with the suffix
awill be created in the database ⇒ the names of the audited charts must have a maximum of 28 characters - As a primary key we use the
uuidgenerated on the application logic (for summary, see the next chapter). - We do not create foreign keys - the reference integrity is hold within the application (supposing the use if the non-relational database for a part of the application). The database is used as a data warehouse.
- indexes are created to search for identities according to the links (if the search is based in the links).
- Naming the indexes:
- prefix
idx\_- for a "standard" index - prefix
ux\_- for a "unique" index
- Naming the attributes:
id- identifiercreated,creator,modifier,modified,creator\_id,modifier\_id,original\_creator,original\_creator\_id,original\_modifier,original\_modifier\_id- audit informationstransaction\_id- "User" transaction identifier - entities was saved in this context (batch). It's not related to database transaction.realm\_id- owner organizationname- name, display namecode- code, application usage, could be unique (Codeableinterface)main- naim / dafault flagdisabled- we preferred disabled flag before enabled / active etc. Entity is active by default (Disableableinterface)valid\_from- entity validity start (ValidableEntityinterface)valid\_till- entity validity end (ValidableEntityinterface)external\_id- unique external id (ExternalIdentifiableinterface)external\_code- unique external code (ExternalCodeableinterface)
- Data lengths and types:
varchar(255)- name, code, etcvarchar(2000)- description, long textnumber(38,4)- currency, "real" numbers
Database scripts
For the automatic creation and modification of the database scheme, the database scripts is used.