Naming Conventions

From nuBuilderForte
Jump to navigation Jump to search
  • All table names should be singular and lowercase
  • All field names should be lowercase
  • Use an underscore (_) to separate words in table and field names.
 e.g., grand_total
  • Prefix each field name with a 3-letter lowercase abbreviation of the table name followed by an underscore (_).
 e.g., for the person table: per_name, per_birthdate
  • The PK should be the table name followed by an underscore and id.
 e.g., person_id
  • The PK is recommended to be a VARCHAR(25), auto-generated by nuBuilder using the nuID() function
 (unless using an AUTO_INCREMENT number)
  • Using VARCHAR(25) for PKs allows better compatibility with hash cookies such as #nu_browse_filter#
  • It is recommended that Unique Indexes not be used, and instead rely on internal validation rules to handle duplicate checking
 (due to the way nuBuilder checks for PK uniqueness)
  • Foreign Key (FK) fields should begin with the shortname of the referencing table, followed by an underscore, and then the PK of the referenced table
 e.g., in invoice table, FK to person table should be inv_person_id

Getting Started

  • Display and Input formatting are managed through system tables (zzzzsys_*), such as format, form, browse, and report
  • Start with your own tables or allow nuBuilder to generate them with standard field types (do not modify the default ID field)
  • All nuBuilder application tables should use a VARCHAR(25) type for the PK if auto-generated in globeadmin mode
  • For existing tables using AUTO_INCREMENT INT fields, new IDs must be generated via BeforeSave PHP code
 or the ID field should be defined as AUTO_INCREMENT NULL in the DB
  • Alternatively, conform to the VARCHAR(25) ID convention and maintain a separate unique INT or other field that previously served as the PK outside of nuBuilder