]> git.mjollnir.org Git - moodle.git/commitdiff
New tables for messaging system, plus completion of the dst_preset
authormoodler <moodler>
Thu, 16 Dec 2004 12:39:17 +0000 (12:39 +0000)
committermoodler <moodler>
Thu, 16 Dec 2004 12:39:17 +0000 (12:39 +0000)
tables in Postgres and new installs

lib/db/mysql.php
lib/db/mysql.sql
lib/db/postgres7.php
lib/db/postgres7.sql
version.php

index 39571da3b45113f79bdab20b862dd9eea2a6bbf1..9675ea30757dbe082dc90ca435558ad27d8eefd8 100644 (file)
@@ -1036,6 +1036,33 @@ function main_upgrade($oldversion=0) {
             
             PRIMARY KEY (id))");
     }       
+
+    if ($oldversion < 2004121600) {
+        modify_database('',"CREATE TABLE `prefix_message` (
+                               `id` int(10) unsigned NOT NULL auto_increment,
+                               `useridfrom` int(10) NOT NULL default '0',
+                               `useridto` int(10) NOT NULL default '0',
+                               `message` text NOT NULL,
+                               `timemodified` int(10) NOT NULL default '0',
+                               `messagetype` varchar(50) NOT NULL default '',
+                               PRIMARY KEY  (`id`),
+                               KEY `useridfrom` (`useridfrom`),
+                               KEY `useridto` (`useridto`)
+                             ) TYPE=MyISAM COMMENT='Stores all unread messages';");
+
+        modify_database('',"CREATE TABLE `prefix_message_read` (
+                               `id` int(10) unsigned NOT NULL auto_increment,
+                               `useridfrom` int(10) NOT NULL default '0',
+                               `useridto` int(10) NOT NULL default '0',
+                               `message` text NOT NULL,
+                               `timemodified` int(10) NOT NULL default '0',
+                               `messagetype` varchar(50) NOT NULL default '',
+                               `mailed` tinyint(1) NOT NULL default '0',
+                               PRIMARY KEY  (`id`),
+                               KEY `useridfrom` (`useridfrom`),
+                               KEY `useridto` (`useridto`)
+                             ) TYPE=MyISAM COMMENT='Stores all messages that have been read';");
+    }
        
     return $result;
 
index 270c79e6067d66aebf43300c4c3f85ba7fe921c0..7fefb5714faf1eb16188b08551ab5529ea1953bf 100644 (file)
@@ -143,6 +143,30 @@ CREATE TABLE `prefix_course_sections` (
 ) TYPE=MyISAM;
 # --------------------------------------------------------
 
+# 
+# Table structure for table `dst_preset`
+# 
+
+CREATE TABLE `prefix_dst_preset` (
+  `id` int(10) NOT NULL auto_increment,
+  `name` char(48) NOT NULL default '',
+  `apply_offset` tinyint(3) NOT NULL default '0',
+  `activate_index` tinyint(1) NOT NULL default '1',
+  `activate_day` tinyint(1) NOT NULL default '1',
+  `activate_month` tinyint(2) NOT NULL default '1',
+  `activate_time` char(5) NOT NULL default '03:00',
+  `deactivate_index` tinyint(1) NOT NULL default '1',
+  `deactivate_day` tinyint(1) NOT NULL default '1',
+  `deactivate_month` tinyint(2) NOT NULL default '2',
+  `deactivate_time` char(5) NOT NULL default '03:00',
+  `last_change` int(10) NOT NULL default '0',
+  `next_change` int(10) NOT NULL default '0',
+  `current_offset` tinyint(3) NOT NULL default '0',
+  PRIMARY KEY  (`id`)
+) TYPE=MyISAM;
+
+# --------------------------------------------------------
+
 #
 # Table structure for table `event`
 #
@@ -276,6 +300,41 @@ CREATE TABLE `prefix_log_display` (
 ) TYPE=MyISAM COMMENT='For a particular module/action, specifies a moodle table/field.';
 # --------------------------------------------------------
 
+#
+# Table structure for table `message`
+#
+
+CREATE TABLE `prefix_message` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `useridfrom` int(10) NOT NULL default '0',
+  `useridto` int(10) NOT NULL default '0',
+  `message` text NOT NULL,
+  `timemodified` int(10) NOT NULL default '0',
+  `messagetype` varchar(50) NOT NULL default '',
+  PRIMARY KEY  (`id`),
+  KEY `useridfrom` (`useridfrom`),
+  KEY `useridto` (`useridto`)
+) TYPE=MyISAM COMMENT='Stores all unread messages';
+# --------------------------------------------------------
+
+#
+# Table structure for table `message_read`
+#
+
+CREATE TABLE `prefix_message_read` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `useridfrom` int(10) NOT NULL default '0',
+  `useridto` int(10) NOT NULL default '0',
+  `message` text NOT NULL,
+  `timemodified` int(10) NOT NULL default '0',
+  `messagetype` varchar(50) NOT NULL default '',
+  `mailed` tinyint(1) NOT NULL default '0',
+  PRIMARY KEY  (`id`),
+  KEY `useridfrom` (`useridfrom`),
+  KEY `useridto` (`useridto`)
+) TYPE=MyISAM COMMENT='Stores all messages that have been read';
+# --------------------------------------------------------
+
 #
 # Table structure for table `modules`
 #
index 2d1dd5ab0c611dfe6794400760b665765eea68e4..71bc2fc0b7227574351ebfe0bbd3e1252d29fd43 100644 (file)
@@ -781,7 +781,53 @@ function main_upgrade($oldversion=0) {
     if ($oldversion < 2004121400) {
         table_column('groups', '', 'password', 'varchar', '50', '', '', 'not null', 'description');
     }
-    
+
+    if ($oldversion < 2004121600) {
+        modify_database('',"CREATE TABLE prefix_dst_preset (
+                                id SERIAL PRIMARY KEY,
+                                name varchar(48) NOT NULL default '',
+                                apply_offset integer NOT NULL default '0',
+                                activate_index integer NOT NULL default '1',
+                                activate_day integer NOT NULL default '1',
+                                activate_month integer NOT NULL default '1',
+                                activate_time char(5) NOT NULL default '03:00',
+                                deactivate_index integer NOT NULL default '1',
+                                deactivate_day integer NOT NULL default '1',
+                                deactivate_month integer NOT NULL default '2',
+                                deactivate_time char(5) NOT NULL default '03:00',
+                                last_change int(10) NOT NULL default '0',
+                                next_change int(10) NOT NULL default '0',
+                                current_offset integer NOT NULL default '0'
+                             ) TYPE=MyISAM;");
+
+
+        modify_database('',"CREATE TABLE prefix_message (
+                               id SERIAL PRIMARY KEY,
+                               useridfrom integer NOT NULL default '0',
+                               useridto integer NOT NULL default '0',
+                               message text,
+                               timemodified integer NOT NULL default '0',
+                               messagetype varchar(50) NOT NULL default ''
+                            );
+
+                            CREATE INDEX prefix_message_useridfrom_idx ON prefix_message (useridfrom);
+                            CREATE INDEX prefix_message_useridto_idx ON prefix_message (useridto);
+
+                            CREATE TABLE prefix_message_read (
+                               id SERIAL PRIMARY KEY,
+                               useridfrom integer NOT NULL default '0',
+                               useridto integer NOT NULL default '0',
+                               message text,
+                               timemodified integer NOT NULL default '0',
+                               messagetype varchar(50) NOT NULL default '',
+                               mailed integer NOT NULL default '0'
+                            );
+
+                            CREATE INDEX prefix_message_read_useridfrom_idx ON prefix_message_read (useridfrom);
+                            CREATE INDEX prefix_message_read_useridto_idx ON prefix_message_read (useridto);
+                            ");
+    }
+                                
     return $result;
 }
 
index d5c862727f80e9dab48da91b4f97b68e36c36747..38955cd628e3ba28d4922543b4062092169b9a32 100644 (file)
@@ -94,6 +94,23 @@ CREATE TABLE prefix_course_sections (
 
 CREATE INDEX prefix_course_sections_coursesection_idx ON prefix_course_sections (course,section);
 
+CREATE TABLE prefix_dst_preset (
+   id SERIAL PRIMARY KEY,
+   name varchar(48) NOT NULL default '',
+   apply_offset integer NOT NULL default '0',
+   activate_index integer NOT NULL default '1',
+   activate_day integer NOT NULL default '1',
+   activate_month integer NOT NULL default '1',
+   activate_time char(5) NOT NULL default '03:00',
+   deactivate_index integer NOT NULL default '1',
+   deactivate_day integer NOT NULL default '1',
+   deactivate_month integer NOT NULL default '2',
+   deactivate_time char(5) NOT NULL default '03:00',
+   last_change int(10) NOT NULL default '0',
+   next_change int(10) NOT NULL default '0',
+   current_offset integer NOT NULL default '0'
+) TYPE=MyISAM;
+
 CREATE TABLE prefix_event (
    id SERIAL PRIMARY KEY,
    name varchar(255) NOT NULL default '',
@@ -165,6 +182,31 @@ CREATE TABLE prefix_log_display (
    field varchar(40) NOT NULL default ''
 );
 
+CREATE TABLE prefix_message (
+   id SERIAL PRIMARY KEY,
+   useridfrom integer NOT NULL default '0',
+   useridto integer NOT NULL default '0',
+   message text,
+   timemodified integer NOT NULL default '0',
+   messagetype varchar(50) NOT NULL default ''
+);
+
+CREATE INDEX prefix_message_useridfrom_idx ON prefix_message (useridfrom);
+CREATE INDEX prefix_message_useridto_idx ON prefix_message (useridto);
+
+CREATE TABLE prefix_message_read (
+   id SERIAL PRIMARY KEY,
+   useridfrom integer NOT NULL default '0',
+   useridto integer NOT NULL default '0',
+   message text,
+   timemodified integer NOT NULL default '0',
+   messagetype varchar(50) NOT NULL default '',
+   mailed integer NOT NULL default '0'
+);
+
+CREATE INDEX prefix_message_read_useridfrom_idx ON prefix_message_read (useridfrom);
+CREATE INDEX prefix_message_read_useridto_idx ON prefix_message_read (useridto);
+
 CREATE TABLE prefix_modules (
    id SERIAL PRIMARY KEY,
    name varchar(20) NOT NULL default '',
index 2bffd8dcf9043e302f3108ec6453a0f1b8cb4fc9..4628f5bedd32e7d6e08ba8d04a60bc42b0ca1636 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine 
 // whether upgrades should be performed (see lib/db/*.php)
 
-   $version = 2004121500;  // YYYYMMDD = date of first major branch release 1.4
+   $version = 2004121600;  // YYYYMMDD = date of first major branch release 1.4
                            //       XY = increments within a single day
 
    $release = '1.5 UNSTABLE DEVELOPMENT';    // Human-friendly version name