From: moodler
Date: Sun, 30 Nov 2003 08:31:08 +0000 (+0000)
Subject: Added information about databases
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e935da6f31b7e72bdd20f54ee60ba288d6afe387;p=moodle.git
Added information about databases
---
diff --git a/lang/en/docs/coding.html b/lang/en/docs/coding.html
index e1679c6fad..dd9df05621 100755
--- a/lang/en/docs/coding.html
+++ b/lang/en/docs/coding.html
@@ -161,6 +161,16 @@ GOOD: $assignments (for an array of objects)
}
+Database structures
+
+ - Every table must have an auto-incrementing id field (INT(10)) as primary index.
+ - The main table containing instances of each module must have the same name as the module (eg widget)
+ - Other tables associated with a module that contain information about 'things' should be named widget_things (note the plural)
+ - Column names should be simple and short, following the same rules as for variable names.
+ - Columns that contain a reference to the id field of another table (eg widget) should be called widgetid.
+ - Boolean fields should be implemented as small integer fields (eg INT(4)) containing 0 or 1, to allow for later expansion of values if necessary.
+ - Most tables should have a timemodified field (INT(10) which is updated with a current timestamp obtained with the PHP time() function.
+
Moodle Documentation
Version: $Id$