
# Set names, if mysql version is 4.1.x

#SET NAMES gbk;

# Warnning: This script is only for LyBBS ver 5.0.MySQL to 6.0 upgrade.

ALTER TABLE db ADD timestatus TINYINT(2)  DEFAULT 0 NOT NULL;
ALTER TABLE db ADD timefromhour TINYINT(2)  DEFAULT 0 NOT NULL;
ALTER TABLE db ADD timefromminute TINYINT(2)  DEFAULT 0 NOT NULL;
ALTER TABLE db ADD timetohour TINYINT(2)  DEFAULT 0 NOT NULL;
ALTER TABLE db ADD timetominute TINYINT(2)  DEFAULT 0 NOT NULL;
ALTER TABLE posts ADD isrecommend TINYINT(2)  DEFAULT 0 NOT NULL;
ALTER TABLE posts ADD color VARCHAR(8) DEFAULT '' NOT NULL;
ALTER TABLE posts ADD boldcode TINYINT(1) DEFAULT 0 NOT NULL;
ALTER TABLE posts ADD viewmode TINYINT(2) DEFAULT 0 NOT NULL;
ALTER TABLE posts ADD viewnumber SMALLINT(5) DEFAULT 0 NOT NULL;
ALTER TABLE posts DROP markHidden;
ALTER TABLE posts DROP markPost;
ALTER TABLE posts DROP moneyHidden;
ALTER TABLE posts DROP moneyPost;
ALTER TABLE uploadinfo ADD authorid INT(10)  DEFAULT 0 NOT NULL;
ALTER TABLE uploadinfo ADD INDEX ix_uploadinfo_authorid (authorid);

CREATE TABLE lybbs_post_weapon (
  postID INT(10) DEFAULT 0 NOT NULL,
  praiseCount1 INT(10) DEFAULT 0 NOT NULL,
  praiseCount2 INT(10) DEFAULT 0 NOT NULL,
  criticizeCount1 INT(10) DEFAULT 0 NOT NULL,
  criticizeCount2 INT(10) DEFAULT 0 NOT NULL,
  PRIMARY KEY(postID)
) TYPE=MyISAM;

CREATE TABLE lybbs_post_book (
  postID INT(10) DEFAULT 0 NOT NULL,
  authorID INT(10) DEFAULT 0 NOT NULL,
  INDEX(postID,authorID)
) TYPE=MyISAM;

update author set sex='sect' where sex='保密';
update author set education='secret' where education='保密';
update author set marry='secret' where marry='保密';
update author set work='secret' where work='保密';
update author set astro='secret' where astro='保密';
update author set usersx='secret' where usersx='保密';
update author set activetime=now() where activetime='0000-00-00 00:00:00';
UPDATE config SET version= 'ver 6.0.MySQL', versionnumber= '20050530' WHERE id=1;