
# Set names, if mysql version is 4.1.x

#SET NAMES gbk;

# Warnning: This script is only for LyBBS ver 6.2.MySQL to 6.3 upgrade.

ALTER TABLE admin RENAME lybbs_admin;
ALTER TABLE allianceforum RENAME lybbs_allianceforum;
ALTER TABLE allowprivate RENAME lybbs_allowprivate;
ALTER TABLE announcement RENAME lybbs_announcement;
ALTER TABLE author RENAME lybbs_author;
ALTER TABLE boardstatus RENAME lybbs_boardstatus;
ALTER TABLE db RENAME lybbs_db;
ALTER TABLE encourage RENAME lybbs_encourage;
ALTER TABLE forum RENAME lybbs_forum;
ALTER TABLE friend RENAME lybbs_friend;
ALTER TABLE grade RENAME lybbs_grade;
ALTER TABLE icon RENAME lybbs_icon;
ALTER TABLE moneyhiddeninfo RENAME lybbs_moneyhiddeninfo;
ALTER TABLE postcontent RENAME lybbs_postcontent;
ALTER TABLE posts RENAME lybbs_posts;
ALTER TABLE publicstyle RENAME lybbs_publicstyle;
ALTER TABLE reserve RENAME lybbs_reserve;
ALTER TABLE style RENAME lybbs_style;
ALTER TABLE uploadinfo RENAME lybbs_uploadinfo;
ALTER TABLE usergroup RENAME lybbs_usergroup;
ALTER TABLE usergroupprivilege RENAME lybbs_usergroupprivilege;
ALTER TABLE vote RENAME lybbs_vote;
ALTER TABLE voterecord RENAME lybbs_voterecord;
ALTER TABLE webqq RENAME lybbs_webqq;

update lybbs_db set teamlogo=concat('lybbs/',teamlogo) where teamlogo like 'myimages%';
update lybbs_style set backgroundpic=concat('lybbs/',backgroundpic) where backgroundpic like 'skins%';
update lybbs_style set catbackpic=concat('lybbs/',catbackpic) where catbackpic like 'skins%';
update lybbs_style set menubackpic=concat('lybbs/',menubackpic) where menubackpic like 'skins%';
update lybbs_author set imageurl=concat('lybbs/',imageurl) where imageurl like 'avatars%';

CREATE TABLE lybbs_postvalidate (id INT (10) DEFAULT 0 NOT NULL, forum SMALLINT (4) DEFAULT 0 NOT NULL, db SMALLINT (4) DEFAULT 0 NOT NULL, orderby INT (10) DEFAULT 0 NOT NULL, parentid INT (10) DEFAULT 0 NOT NULL, titleimage VARCHAR (20) DEFAULT '' NOT NULL, authorid INT (10) DEFAULT 0 NOT NULL, author VARCHAR (30) DEFAULT '' NOT NULL, title VARCHAR (80) DEFAULT '' NOT NULL, postat DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL, ipfrom VARCHAR (20) DEFAULT '' NOT NULL, accessary CHAR (1) DEFAULT '0' NOT NULL, vote CHAR (1) DEFAULT '0' NOT NULL, viewmode TINYINT (2) DEFAULT 0 NOT NULL, viewnumber SMALLINT (5) DEFAULT 0 NOT NULL, votecondition TINYINT (2) DEFAULT 0 NOT NULL, PRIMARY KEY(id), INDEX(db,parentid));
CREATE TABLE lybbs_postdelete (id INT (10) DEFAULT 0 NOT NULL, forum SMALLINT (4) DEFAULT 0 NOT NULL, db SMALLINT (4) DEFAULT 0 NOT NULL, orderby INT (10) DEFAULT 0 NOT NULL, parentid INT (10) DEFAULT 0 NOT NULL, titleimage VARCHAR (20) DEFAULT '' NOT NULL, authorid INT (10) DEFAULT 0 NOT NULL, author VARCHAR (30) DEFAULT '' NOT NULL, title VARCHAR (80) DEFAULT '' NOT NULL, postat DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL, ipfrom VARCHAR (20) DEFAULT '' NOT NULL, accessary CHAR (1) DEFAULT '0' NOT NULL, vote CHAR (1) DEFAULT '0' NOT NULL, viewmode TINYINT (2) DEFAULT 0 NOT NULL, viewnumber SMALLINT (5) DEFAULT 0 NOT NULL, votecondition TINYINT (2) DEFAULT 0 NOT NULL, PRIMARY KEY(id), INDEX(db,parentid));