$dataobject->userid = $userid;
$dataobject->subject = $title;
$dataobject->format = $formatId;
+ $dataobject->module = 'blog';
$timenow = time();
$dataobject->lastmodified = $timenow;
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;
}
);
#
-# 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',
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 (
}
}
+ 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;
}
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,
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 (
// 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