Column names

Primary Key columns

  • Give every table a primary key named id (lower case)
    AppGini will automatically apply necessary and useful settings
  • Avoid changing the id column unless you know what you are doing

Data columns

  • lower case column names
    • id
    • name
    • subject
    • description
    • ID
    • Name
    • NAME
  • English column names
  • use underscore
    • parent_id
    • ParentId
    • parentId

Foreign key columns

  • singular name of the master name +_id

Lookup columns

Actually, lookup fields are foreign keys. We recommend using the same pattern

Autofill columns

Related to data storage, Autofill columns behave like lookups. They also store the primary key of the parent table. From user-interface point of view they show different information like data from one or two different columns of the parent table.

Although autofill columns store the id of the primary key, we recommend the following naming pattern:

  • singular name of the master name +_ (underscore) + column name of the displayed column

Boolean flags (yes/no or on/off)

If you need simple yes/no or on/off or true/false information, we recommend the following AppGini project settings:

  • use integer as data type
  • check [X] Checkbox
  • do not set the [ ] Required flag
  • do not set any Default value

As naming convention we recommend using one of the following prefixes:

  • is_ or
  • can_ or
  • has_

Pro-Tip
In many situations you need to set the flag manually. But there are also situations in which the state of a checkbox can be evaluated by using database queries. You can make use of the new "calculated fields" functionality (click here) in AppGini since version 5.8 (October 2019).

Examples

  • is_enabled
  • is_active
  • is_public

or

  • can_edit
  • can_delete
  • can_download

or

  • has_children
  • has_permission

Do you like it?