Max Identifier Lengths on Common RDBMS:
RDMBS
|
Table Name Max Length
|
Column Name Max Length
|
---|---|---|
Oracle
|
30
|
30
|
Sybase
|
30
|
30
|
PostgreSQL
|
31
|
31
|
Sap DB
|
32
|
32
|
MySQL
|
64
|
64
|
Derby
|
128
|
128
|
SQL Server
|
128
|
128
|
DB2
|
128
|
128
|
As can be seen there are a couple of databases (most notably Oracle) which restrict Table and Column name length to 30 characters. So our target should be 30 characters or less.
Tables, Views and Sequences
Because of the 30 character restriction, we need to design our database object name prefixes so that they take up the least amount of that space while still being descriptive enough.
We will use the following standard prefix:
<Application Acronym><2-letter Module Acronym>_
For Kuali Rice, this will be:
Rice Module
|
Prefix
|
Pre-Refactoring Notes
|
---|---|---|
KSB
|
KRSB_
|
|
KNS
|
KRNS_
|
Majority of tables currently prefixed with one of:
|
KEW
|
KREW_
|
Tables are currently prefixed with EN_
|
KIM
|
KRIM_
| |
KEN
|
KREN_
|
|
Columns
Column names on tables and views should not contain prefixes or suffixes. Also, there are a few cases in our current column names where we are duplicating parts of the table names. This is a bit redundant and should be eliminated. For example, on EN_ACTN_RQST_T there are columns named ACTN_RQST_RECP_TYP_CD, ACTN_RQST_PRIO_NBR, etc. Where they could be named just RECP_TYP_CD, PRIO_NBR, etc. This would serve to make the column names as compact as possible
Besides what mentioned above, the rules for column are similar to those for table names.
Primary Keys, Foreign Keys, Indexes and Unique Constraints
The naming standards are very similar for PKs, FKs, indexes and unique constraints:
Exceptions to Standards
In some cases it is not possible to follow these naming standards. This is a particular problem if using vended libraries which have their own pre-defined table names.
Quartz is an example of this. However, Quartz does provide the ability to specify custom table prefixes. Such features should be taken advantage of when they are available.
See the table at the top of this document which indicates how the Quartz tables should be prefixed in the case of Kuali Rice.
Abbreviations
Before using any abbreviation in any of the database identifiers, an attempt should be made to establish if an abbreviation has already been used in other tables for that same word. Some examples, of common abbreviations seen throughout Rice are below:
Word
|
Abbreviation
|
---|---|
action
|
ACTN
|
code
|
CD
|
date
|
DT
|
description
|
DESC_TXT
|
document
|
DOC
|
header
|
HDR
|
identifier
|
ID
|
indicator
|
IND
|
namespace
|
NMSPC
|
parameter
|
PARM
|
request
|
RQST
|
title
|
TTL
|
type
|
TYP
|
version number
|
VER_NBR
|
...
|
...
|
This is by no means exhaustive but demonstrates the general idea when choosing abbreviations.
沒有留言:
張貼留言