summaryrefslogtreecommitdiff
path: root/database
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-01-19 16:22:52 +0000
committerDries Buytaert <dries@buytaert.net>2005-01-19 16:22:52 +0000
commit7bdca92aadf956a3e4e65815fbdcccad2f791802 (patch)
tree1aa9dca9f7ae4460230375b54b7c8eb941c2a53f /database
parent6adc3dd055f2747514f555d5616cfd3f5a791796 (diff)
downloadbrdo-7bdca92aadf956a3e4e65815fbdcccad2f791802.tar.gz
brdo-7bdca92aadf956a3e4e65815fbdcccad2f791802.tar.bz2
- Patch #6847 by Gerhard: replaced vocabulary->nodes by a separate table and tidied up the taxonomy API a bit. This fixes a number of issues.
Diffstat (limited to 'database')
-rw-r--r--database/database.mysql11
-rw-r--r--database/database.pgsql11
-rw-r--r--database/updates.inc36
3 files changed, 55 insertions, 3 deletions
diff --git a/database/database.mysql b/database/database.mysql
index 18e9731e3..3a02be088 100644
--- a/database/database.mysql
+++ b/database/database.mysql
@@ -749,12 +749,21 @@ CREATE TABLE vocabulary (
hierarchy tinyint(3) unsigned NOT NULL default '0',
multiple tinyint(3) unsigned NOT NULL default '0',
required tinyint(3) unsigned NOT NULL default '0',
- nodes longtext,
weight tinyint(4) NOT NULL default '0',
PRIMARY KEY (vid)
) TYPE=MyISAM;
--
+-- Table structure for table 'vocabulary_node_types'
+--
+
+CREATE TABLE vocabulary_node_types (
+ vid int(10) unsigned NOT NULL DEFAULT '0',
+ type varchar(16) NOT NULL DEFAULT '',
+ PRIMARY KEY (vid, type)
+) TYPE=MyISAM;
+
+--
-- Table structure for table 'watchdog'
--
diff --git a/database/database.pgsql b/database/database.pgsql
index 7e312e54c..d2d807f24 100644
--- a/database/database.pgsql
+++ b/database/database.pgsql
@@ -736,12 +736,21 @@ CREATE TABLE vocabulary (
hierarchy smallint NOT NULL default '0',
multiple smallint NOT NULL default '0',
required smallint NOT NULL default '0',
- nodes text default '',
weight smallint NOT NULL default '0',
PRIMARY KEY (vid)
);
--
+-- Table structure for vocabulary_node_types
+--
+
+CREATE TABLE vocabulary_node_types (
+ vid integer NOT NULL default '0',
+ type varchar(16) NOT NULL default '',
+ PRIMARY KEY (vid, type)
+);
+
+--
-- Table structure for watchdog
--
diff --git a/database/updates.inc b/database/updates.inc
index a0791c056..c1d5b566f 100644
--- a/database/updates.inc
+++ b/database/updates.inc
@@ -92,7 +92,9 @@ $sql_updates = array(
"2004-11-28" => "update_113",
"2004-12-05" => "update_114",
"2005-01-07" => "update_115",
- "2005-01-14" => "update_116"
+ "2005-01-14" => "update_116",
+ "2005-01-18" => "update_117",
+ "2005-01-19" => "update_118"
);
function update_32() {
@@ -2083,6 +2085,38 @@ function update_116() {
return array(update_sql("DELETE FROM {system} WHERE name = 'admin'"));
}
+function update_117() {
+ $ret = array();
+ if ($GLOBALS['db_type'] == 'mysql') {
+ $ret[] = update_sql("CREATE TABLE {vocabulary_node_types} (
+ vid int(10) NOT NULL default '',
+ type varchar(16) NOT NULL default '',
+ PRIMARY KEY (vid, type))");
+ }
+ else if ($GLOBALS['db_type'] == 'pgsql') {
+ $ret[] = update_sql("CREATE TABLE {vocabulary_node_types} (
+ vid integer NOT NULL default '0',
+ type varchar(16) NOT NULL default '',
+ PRIMARY KEY (vid, type))");
+ }
+ return $ret;
+}
+
+function update_118() {
+ $ret = array();
+ $result = db_query('SELECT vid, nodes FROM {vocabulary}');
+ while ($vocabulary = db_fetch_object($result)) {
+ $node_types[$vocabulary->vid] = explode(',', $vocabulary->nodes);
+ }
+ foreach ($node_types as $vid => $type_array) {
+ foreach ($type_array as $type) {
+ db_query("INSERT INTO {vocabulary_node_types} (vid, type) VALUES (%d, '%s')", $vid, $type);
+ }
+ }
+ $ret[] = update_sql("ALTER TABLE {vocabulary} DROP nodes");
+ return $ret;
+}
+
function update_sql($sql) {
$edit = $_POST["edit"];
$result = db_query($sql);