diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-10-01 05:18:03 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-10-01 05:18:03 +0000 |
commit | fa2581edcfa52c847db93a9421de5216fb0072f6 (patch) | |
tree | 157fe17cb4af14b4b927ce157c29ab8fd9b894cf /update.php | |
parent | 392304da5f4a6f86d8ab8b5f91d38a698d1dcc88 (diff) | |
download | brdo-fa2581edcfa52c847db93a9421de5216fb0072f6.tar.gz brdo-fa2581edcfa52c847db93a9421de5216fb0072f6.tar.bz2 |
- Modifies path.module to get rid of pgsql reserved word. Patch by Adrian.
- Updates database.pgsql and database.mysql to work with current cvs. Patch
by Adrian.
- Updates update.php to be able to update postgres from 4.2 to current.
Patch by Adrian.
- Small fixes by me.
Diffstat (limited to 'update.php')
-rw-r--r-- | update.php | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/update.php b/update.php index d27375187..f954524a2 100644 --- a/update.php +++ b/update.php @@ -454,28 +454,46 @@ function update_65() { update_sql("CREATE FUNCTION \"rand\"() RETURNS float AS ' BEGIN RETURN random(); - END;' LANGUAGE 'plpgsql';"); + END;' LANGUAGE 'plpgsql'"); } } function update_66() { - update_sql("CREATE TABLE path ( - pid int(10) unsigned NOT NULL auto_increment, - old varchar(128) NOT NULL default '', - new varchar(128) NOT NULL default '', - PRIMARY KEY (pid), - UNIQUE KEY old (old), - UNIQUE KEY new (new) - )"); + if ($GLOBALS["db_type"] == "pgsql") { + update_sql("CREATE TABLE {path} ( + pid integer NOT NULL default '0', + src varchar(128) NOT NULL default '', + dst varchar(128) NOT NULL default '', + PRIMARY KEY (pid) + )"); + update_sql("CREATE INDEX path_src_idx ON {path}(src)"); + update_sql("CREATE INDEX path_dst_idx ON {path}(dst)"); + $result = db_query("SELECT nid, path FROM {node} WHERE path != ''"); + while ($node = db_fetch_object($result)) { + update_sql("INSERT INTO {path} (src, dst) VALUES ('node/view/$node->nid', '". check_query($node->path) ."')"); + } + + /* most versions of pgsql are incapable of dropping columns */ - // Migrate the existing paths: - $result = db_query("SELECT nid, path FROM {node} WHERE path != ''"); - while ($node = db_fetch_object($result)) { - update_sql("INSERT INTO {path} (old, new) VALUES ('node/view/$node->nid', '". check_query($node->path) ."')"); } + else { + update_sql("CREATE TABLE {path} ( + pid int(10) unsigned NOT NULL auto_increment, + src varchar(128) NOT NULL default '', + dst varchar(128) NOT NULL default '', + PRIMARY KEY (pid), + UNIQUE KEY src (src), + UNIQUE KEY dst (dst) + )"); + // Migrate the existing paths: + $result = db_query("SELECT nid, path FROM {node} WHERE path != ''"); + while ($node = db_fetch_object($result)) { + update_sql("INSERT INTO {path} (src, dst) VALUES ('node/view/$node->nid', '". check_query($node->path) ."')"); + } - update_sql("ALTER TABLE {node} DROP path"); - } + update_sql("ALTER TABLE {node} DROP path"); + } +} /* ** System functions |