]> git.mjollnir.org Git - moodle.git/commitdiff
Added a new field "module" to the post table to indicate what type of module
authormoodler <moodler>
Mon, 20 Mar 2006 07:13:21 +0000 (07:13 +0000)
committermoodler <moodler>
Mon, 20 Mar 2006 07:13:21 +0000 (07:13 +0000)
each entry is

blog/class.BlogInfo.php
lib/db/mysql.php
lib/db/mysql.sql
lib/db/postgres7.php
lib/db/postgres7.sql
version.php

index 6083ef501cf73c2b10874df1ef269f437b41e192..48d62c119a7b78c9c3b3abaa799de1b00c3e1842 100755 (executable)
@@ -181,6 +181,7 @@ class BlogInfo {
         $dataobject->userid = $userid;
         $dataobject->subject = $title;
         $dataobject->format = $formatId;
+        $dataobject->module = 'blog';
         
         $timenow = time();
         $dataobject->lastmodified = $timenow;        
index 2829fb274927d90c176a76763e80b4d1829afd95..13c3f4733883695be0633918b0f75f03259b1924 100644 (file)
@@ -1734,6 +1734,12 @@ function main_upgrade($oldversion=0) {
         execute_sql(" ALTER TABLE `{$CFG->prefix}grade_category` CHANGE `weight` `weight` decimal(5,2) default '0.00';");
     }
 
+    if ($oldversion < 2006032000) {
+        table_column('post','','module','varchar','20','','','not null', 'id');
+        modify_database('',"ALTER TABLE prefix_post ADD INDEX post_module_idx (module);");
+        modify_database('',"UPDATE prefix_post SET module = 'blog';");
+    }
+
     return $result;
 }
 
index d5c09a4eebde741ac4689a16e4b7c795ed5f72e6..9708361266501eea667dcbbcfdf36a73099210f9 100644 (file)
@@ -843,10 +843,11 @@ CREATE TABLE prefix_stats_user_monthly (
 );
 
 #
-# Table structure for BRAND NEW MOODLE POST table `prefix_post`
+# Table structure for table `prefix_post`
 #
 CREATE TABLE prefix_post (
   `id` int(11) NOT NULL auto_increment,
+  `module` varchar(20) NOT NULL default '',
   `userid` int(11) NOT NULL default '0',
   `courseid` int(11) NOT NULL default'0',
   `groupid` int(11) NOT NULL default'0',
@@ -864,8 +865,10 @@ CREATE TABLE prefix_post (
   PRIMARY KEY  (`id`),
   UNIQUE KEY `id_user_idx` (`id`, `userid`),
   KEY `post_lastmodified_idx` (`lastmodified`),
+  KEY `post_module_idx` (`module`),
   KEY `post_subject_idx` (`subject`)
-) TYPE=MyISAM  COMMENT='New moodle post table. Holds data posts such as forum entries or blog entries.';
+) TYPE=MyISAM  COMMENT='Generic post table to hold data blog entries etc in different modules.';
+
 
 # tags are not limited to blogs
 CREATE TABLE prefix_tags (
index 2cbdc8eb35f212103ceff0bee03b5becdf80a4bd..305f254b233d2061e8a10b88dcba09e4641ae9ce 100644 (file)
@@ -1471,6 +1471,12 @@ function main_upgrade($oldversion=0) {
         }
     }
 
+    if ($oldversion < 2006032000) {
+        table_column('post','','module','varchar','20','','','not null', 'id');
+        modify_database('',"ALTER TABLE prefix_post ADD INDEX post_module_idx (module);");
+        modify_database('',"UPDATE prefix_post SET module = 'blog';");
+    }
+
     return $result;
 }
 
index 184c194145544a43f48ce429819fdcb243c9bc54..b2a0d4186c0ba4441906fbd3138be104a9bdbe5d 100644 (file)
@@ -624,6 +624,7 @@ CREATE INDEX prefix_stats_user_monthly_timeend_idx ON prefix_stats_user_monthly
 
 CREATE TABLE prefix_post (
   id SERIAL PRIMARY KEY,
+  module varchar(20) NOT NULL default '',
   userid INTEGER NOT NULL default 0,
   courseid INTEGER NOT NULL default 0,
   groupid INTEGER NOT NULL default 0,
@@ -642,6 +643,7 @@ CREATE TABLE prefix_post (
 
 CREATE INDEX id_user_idx ON prefix_post  (id, courseid);
 CREATE INDEX post_lastmodified_idx ON prefix_post (lastmodified);
+CREATE INDEX post_module_idx ON prefix_post (module);
 CREATE INDEX post_subject_idx ON prefix_post (subject);
 
 CREATE TABLE prefix_tags (
index 87f5a7dbf9b2d56a4b7c90c8d08592127df4a6cd..6a2ce9ecf4e30d5e0755b3b64d1984bf32a0803f 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 = 2006031600;  // YYYYMMDD = date
+   $version = 2006032000;  // YYYYMMDD = date
                            //       XY = increments within a single day
 
    $release = '1.6 development';    // Human-friendly version name