- 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
3-00
Dries Buytaert 2001-03-25 11:25:30 +00:00
parent 1f79863053
commit 5b92e9099f
3 changed files with 69 additions and 0 deletions

29
updates/2.00-to-x.xx.php Normal file
View File

@ -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 = ''");
?>

40
updates/2.00-to-x.xx.sql Normal file
View File

@ -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;