summaryrefslogtreecommitdiff
path: root/update.php
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2002-08-20 19:29:16 +0000
committerDries Buytaert <dries@buytaert.net>2002-08-20 19:29:16 +0000
commitbfe5b85dbdab7b0c9f868dcb3beb71848ffbd295 (patch)
tree222ac3236359bdc76cfea99c09911d016fe23488 /update.php
parentafd87425d98ee62864911a2ccd29beb0eea843cb (diff)
downloadbrdo-bfe5b85dbdab7b0c9f868dcb3beb71848ffbd295.tar.gz
brdo-bfe5b85dbdab7b0c9f868dcb3beb71848ffbd295.tar.bz2
- Applied a (modified) version of Marco's SQL sequence patch.
Diffstat (limited to 'update.php')
-rw-r--r--update.php26
1 files changed, 25 insertions, 1 deletions
diff --git a/update.php b/update.php
index 302ab3fab..9c74537d3 100644
--- a/update.php
+++ b/update.php
@@ -48,7 +48,8 @@ $mysql_updates = array(
"2002-07-07" => "update_33",
"2002-07-31" => "update_34",
"2002-08-10" => "update_35",
- "2002-08-16" => "update_36"
+ "2002-08-16" => "update_36",
+ "2002-08-19" => "update_37"
);
// Update functions
@@ -508,6 +509,29 @@ function update_36() {
update_sql("ALTER TABLE rating CHANGE new current int(6) NOT NULL default '0';");
}
+function update_37() {
+
+ update_sql("DROP TABLE IF EXISTS sequences;");
+
+ update_sql("CREATE TABLE sequences (
+ name VARCHAR(255) NOT NULL PRIMARY KEY,
+ id INT UNSIGNED NOT NULL
+ ) TYPE=MyISAM;");
+
+ if ($max = db_result(db_query("SELECT MAX(nid) FROM node;"))) {
+ update_sql("REPLACE INTO sequences VALUES ('node', $max);");
+ }
+
+ if ($max = db_result(db_query("SELECT MAX(cid) FROM comments;"))) {
+ update_sql("REPLACE INTO sequences VALUES ('comments', $max);");
+ }
+ // NOTE: move the comments bit down as soon as we switched to use the new comment module!
+
+ if ($max = db_result(db_query("SELECT MAX(tid) FROM term_data;"))) {
+ update_sql("REPLACE INTO sequences VALUES ('term_data', $max);");
+ }
+}
+
function update_upgrade3() {
update_sql("INSERT INTO system VALUES ('archive.module','archive','module','',1);");
update_sql("INSERT INTO system VALUES ('block.module','block','module','',1);");