From 838ee71b4b78459f3615f05d2385fb983b43e39e Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 24 Jun 2004 11:46:53 +0000 Subject: [PATCH] New course field called idnumber ... acts as storage for an external id number for each course. Used in external processing of course and user_students and user_teachers tables. --- lib/db/mysql.php | 6 ++++++ lib/db/mysql.sql | 1 + lib/db/postgres7.php | 6 ++++++ lib/db/postgres7.sql | 1 + 4 files changed, 14 insertions(+) diff --git a/lib/db/mysql.php b/lib/db/mysql.php index 9677fc148a..d115b6d50f 100644 --- a/lib/db/mysql.php +++ b/lib/db/mysql.php @@ -780,6 +780,12 @@ function main_upgrade($oldversion=0) { table_column('user_teachers', "", 'timestart', 'int', '10', 'unsigned', '0', 'not null', 'editall'); } + if ($oldversion < 2004062401) { + table_column('course', '', 'idnumber', 'varchar', '100', '', '', 'not null', 'shortname'); + execute_sql('UPDATE '.$CFG->prefix.'course SET idnumber = shortname'); // By default + } + + return $result; } diff --git a/lib/db/mysql.sql b/lib/db/mysql.sql index 31d76d04c8..f4245c1866 100644 --- a/lib/db/mysql.sql +++ b/lib/db/mysql.sql @@ -34,6 +34,7 @@ CREATE TABLE `prefix_course` ( `password` varchar(50) NOT NULL default '', `fullname` varchar(254) NOT NULL default '', `shortname` varchar(15) NOT NULL default '', + `idnumber` varchar(50) NOT NULL default '', `summary` text NOT NULL, `format` varchar(10) NOT NULL default 'topics', `showgrades` smallint(2) unsigned NOT NULL default '1', diff --git a/lib/db/postgres7.php b/lib/db/postgres7.php index a76a30a1e5..fde22d3fce 100644 --- a/lib/db/postgres7.php +++ b/lib/db/postgres7.php @@ -522,6 +522,12 @@ function main_upgrade($oldversion=0) { table_column('user_teachers', "", 'timestart', 'int', '10', 'unsigned', '0', 'not null', 'editall'); } + if ($oldversion < 2004062401) { + table_column('course', '', 'idnumber', 'varchar', '100', '', '', 'not null', 'shortname'); + execute_sql('UPDATE '.$CFG->prefix.'course SET idnumber = shortname'); // By default + } + + return $result; } diff --git a/lib/db/postgres7.sql b/lib/db/postgres7.sql index 79efebec9e..0aa75b647e 100644 --- a/lib/db/postgres7.sql +++ b/lib/db/postgres7.sql @@ -12,6 +12,7 @@ CREATE TABLE prefix_course ( password varchar(50) NOT NULL default '', fullname varchar(254) NOT NULL default '', shortname varchar(15) NOT NULL default '', + idnumber varchar(100) NOT NULL default '', summary text NOT NULL default '', format varchar(10) NOT NULL default 'topics', showgrades integer NOT NULL default '1', -- 2.39.5