diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-03-25 11:25:30 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-03-25 11:25:30 +0000 |
commit | 5b92e9099f45a779359cdf85f27874619bb8358f (patch) | |
tree | 762521b1835f0560bb9960885864ee23bb77981d | |
parent | 1f79863053350f1a7d6cb654ac615123bc3b5133 (diff) | |
download | brdo-5b92e9099f45a779359cdf85f27874619bb8358f.tar.gz brdo-5b92e9099f45a779359cdf85f27874619bb8358f.tar.bz2 |
- reorganized the ./update directory a bit
- added 2 new files:
a. 2.00-to-x.xx.sql contains the SQL table changes/additions
b. 2.00-to.x.xx.php is a script which converts your existing
data to the new SQL tables
-rw-r--r-- | updates/1.00-to-2.00.sql (renamed from updates/1.00-to-2.00) | 0 | ||||
-rw-r--r-- | updates/2.00-to-x.xx.php | 29 | ||||
-rw-r--r-- | updates/2.00-to-x.xx.sql | 40 |
3 files changed, 69 insertions, 0 deletions
diff --git a/updates/1.00-to-2.00 b/updates/1.00-to-2.00.sql index dd9bec7aa..dd9bec7aa 100644 --- a/updates/1.00-to-2.00 +++ b/updates/1.00-to-2.00.sql diff --git a/updates/2.00-to-x.xx.php b/updates/2.00-to-x.xx.php new file mode 100644 index 000000000..18ed3254b --- /dev/null +++ b/updates/2.00-to-x.xx.php @@ -0,0 +1,29 @@ +<?php + +include "includes/common.inc"; + +db_query("DELETE FROM watchdog"); +db_query("DELETE FROM nodes"); +db_query("DELETE FROM story"); +db_query("DELETE FROM book"); + +db_query("UPDATE comments SET type = 'story' WHERE type = 'stories'"); + +$result = db_query("SELECT * FROM stories"); +while ($story = db_fetch_object($result)) { + $node = array(title => $story->subject, abstract => $story->abstract, body => $story->article, section => $story->section, timestamp => $story->timestamp, votes => $story->votes, score => $stort->score, author => $story->author, type => "story"); + if ($story->status == 2) $node[status] = $status[posted]; + if ($story->status == 1) $node[status] = $status[queued]; + if ($story->status == 0) $node[status] = $status[dumped]; + node_save($node); +} + +$result = db_query("SELECT * FROM faqs"); +while ($faq = db_fetch_object($result)) { + $node = array(title => $faq->question, author => 1, body => $faq->answer, weight => $faq->weight, status => $status[posted], type => "book"); + node_save($node); +} + +db_query("update users set history = ''"); + +?>
\ No newline at end of file diff --git a/updates/2.00-to-x.xx.sql b/updates/2.00-to-x.xx.sql new file mode 100644 index 000000000..2fdb0bdcb --- /dev/null +++ b/updates/2.00-to-x.xx.sql @@ -0,0 +1,40 @@ +# 25/03/2001: +CREATE TABLE book ( + id int(10) unsigned DEFAULT '0' NOT NULL auto_increment, + node int(10) unsigned DEFAULT '0' NOT NULL, + body text NOT NULL, + section int(10) DEFAULT '0' NOT NULL, + parent int(10) DEFAULT '0' NOT NULL, + weight tinyint(3) DEFAULT '0' NOT NULL, + PRIMARY KEY (id) +); + +CREATE TABLE story ( + id int(10) unsigned DEFAULT '0' NOT NULL auto_increment, + node int(10) unsigned DEFAULT '0' NOT NULL, + abstract text NOT NULL, + body text NOT NULL, + section varchar(64) DEFAULT '' NOT NULL, + PRIMARY KEY (id) +); + +CREATE TABLE nodes ( + nid int(10) unsigned DEFAULT '0' NOT NULL auto_increment, + lid int(6) DEFAULT '0' NOT NULL, + pid int(6) DEFAULT '0' NOT NULL, + log text NOT NULL, + type varchar(16) DEFAULT '' NOT NULL, + title varchar(128) DEFAULT '' NOT NULL, + score int(11) DEFAULT '0' NOT NULL, + votes int(11) DEFAULT '0' NOT NULL, + author int(6) DEFAULT '0' NOT NULL, + status int(4) DEFAULT '1' NOT NULL, + timestamp int(11) NOT NULL, + KEY type (lid, type), + KEY author (author), + KEY title (title, type), + PRIMARY KEY (nid) +); + +alter table users change stories nodes tinyint(2) DEFAULT '10'; +alter table comments drop type; |