From 0c3ffa2f7a657c73944c4b0c6d9cef85644638a2 Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 9 Dec 2003 06:07:12 +0000 Subject: [PATCH] Fixed up some ommissions about database structure --- lang/en/docs/coding.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lang/en/docs/coding.html b/lang/en/docs/coding.html index d29bd64cae..faad02f9d8 100755 --- a/lang/en/docs/coding.html +++ b/lang/en/docs/coding.html @@ -165,10 +165,16 @@ GOOD: $assignments (for an array of objects)

Database structures

  1. Every table must have an auto-incrementing id field (INT10) as primary index.
  2. -
  3. The main table containing instances of each module must have the same name as the module (eg widget).
  4. +
  5. The main table containing instances of each module must have the same name as the module (eg widget) and contain the following minimum fields: +
      +
    • id - as described above
    • +
    • course - the id of the course that each instance belongs to
    • +
    • name - the full name of each instance of the module
    • +
    +
  6. Other tables associated with a module that contain information about 'things' should be named widget_things (note the plural).
  7. Column names should be simple and short, following the same rules as for variable names.
  8. -
  9. Columns that contain a reference to the id field of another table (eg widget) should be called widgetid.
  10. +
  11. Where possible, columns that contain a reference to the id field of another table (eg widget) should be called widgetid. (Note that this convention is newish and not followed in some older tables)
  12. Boolean fields should be implemented as small integer fields (eg INT4) containing 0 or 1, to allow for later expansion of values if necessary.
  13. Most tables should have a timemodified field (INT10) which is updated with a current timestamp obtained with the PHP time() function.
-- 2.39.5