From: tjhunt Date: Thu, 24 Aug 2006 15:37:03 +0000 (+0000) Subject: During the conversion datalib -> ddllib, Eloy removed my comment that made it possibl... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=dd4a1bca2895c26c1a81ea454afe5f61014b9bda;p=moodle.git During the conversion datalib -> ddllib, Eloy removed my comment that made it possible to understand how to use table_colum :-( Adding it back. --- diff --git a/lib/ddllib.php b/lib/ddllib.php index 67f4ee313e..738439cfa4 100644 --- a/lib/ddllib.php +++ b/lib/ddllib.php @@ -61,6 +61,24 @@ require_once($CFG->libdir . '/xmlize.php'); +/** + * Add a new field to a table, or modify an existing one (if oldfield is defined). + * Warning: Please be careful on primary keys, as this function will eat auto_increments + * + * @uses $CFG + * @uses $db + * @param string $table the name of the table to modify. (Without the prefix.) + * @param string $oldfield If changing an existing column, the name of that column. + * @param string $field The name of the column at the end of the operation. + * @param string $type The type of the column at the end of the operation. TEXT, VARCHAR, CHAR, INTEGER, REAL, or TINYINT + * @param string $size The size of that column type. As in VARCHAR($size), or INTEGER($size). + * @param string $signed For numeric column types, whether that column is 'signed' or 'unsigned'. + * @param string $default The new default value for the column. + * @param string $null 'not null', or '' to allow nulls. + * @param string $after Which column to insert this one after. Not supported on Postgres. + * + * @return boolean Wheter the operation succeeded. + */ function table_column($table, $oldfield, $field, $type='integer', $size='10', $signed='unsigned', $default='0', $null='not null', $after='') { global $CFG, $db, $empty_rs_cache;