
CREATE TABLE supe_announcements (
  id smallint(6) unsigned NOT NULL auto_increment,
  uid mediumint(8) unsigned NOT NULL default '0',
  author varchar(15) NOT NULL default '',
  `subject` varchar(80) NOT NULL default '',
  displayorder tinyint(3) unsigned NOT NULL default '0',
  starttime int(10) unsigned NOT NULL default '0',
  endtime int(10) unsigned NOT NULL default '0',
  message text NOT NULL default '',
  PRIMARY KEY  (id),
  KEY timespan (starttime,endtime)
) TYPE=MyISAM;

CREATE TABLE `supe_corpus` (
  cid mediumint(8) unsigned NOT NULL auto_increment,
  authorid mediumint(8) unsigned NOT NULL default '0',
  author varchar(15) NOT NULL default '',
  corpusname varchar(100) NOT NULL default '',
  resume text NOT NULL default '',
  background varchar(15) NOT NULL default '',
  blogs text NOT NULL default '',
  catalog text NOT NULL default '',
  cover text NOT NULL default '',
  prelude text NOT NULL default '',
  backcover text NOT NULL default '',
  createdate int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (cid),
  KEY authorid (authorid,createdate)
) TYPE=MyISAM;

CREATE TABLE supe_goodsprice (
  priceid mediumint(8) unsigned NOT NULL auto_increment,
  itemid mediumint(8) unsigned NOT NULL default '0',
  uid mediumint(8) unsigned NOT NULL default '0',
  price float unsigned NOT NULL default '0',
  buynum smallint(6) unsigned NOT NULL default '0',
  dateline int(10) unsigned NOT NULL default '0',
  `status` tinyint(1) NOT NULL default '0',
  username char(15) NOT NULL default '',
  PRIMARY KEY  (priceid),
  KEY itemid (itemid)
) TYPE=MyISAM;

CREATE TABLE supe_tracks (
  uid mediumint(8) unsigned NOT NULL default '0',
  itemid mediumint(8) unsigned NOT NULL default '0',
  dateline int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (uid,itemid)
) TYPE=MyISAM;

CREATE TABLE supe_usercss (
  id mediumint(8) unsigned NOT NULL auto_increment,
  uid mediumint(8) unsigned NOT NULL default '0',
  `name` varchar(20) NOT NULL default '',
  css text NOT NULL default '',
  dateline int(10) unsigned NOT NULL default '0',
  thumb varchar(150) NOT NULL default '',
  image varchar(150) NOT NULL default '',
  isshare tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (id),
  KEY isshare (isshare),
  KEY uid (uid)
) TYPE=MyISAM;

CREATE TABLE supe_userspacefields (
  uid mediumint(8) unsigned NOT NULL default '0',
  perpage tinyint(3) unsigned NOT NULL default '0',
  announcement text NOT NULL default '',
  showblocks varchar(100) NOT NULL default '',
  blocknames text NOT NULL default '',
  summarylen smallint(6) unsigned NOT NULL default '0',
  attachsize int(12) unsigned NOT NULL default '0',
  jammer tinyint(1) NOT NULL default '0',
  blogmod tinyint(1) NOT NULL default '0',
  blognum tinyint(3) unsigned NOT NULL default '0',
  imagenum tinyint(3) unsigned NOT NULL default '0',
  goodsnum tinyint(3) unsigned NOT NULL default '0',
  filenum tinyint(3) unsigned NOT NULL default '0',
  linknum tinyint(3) unsigned NOT NULL default '0',
  threadnum tinyint(3) unsigned NOT NULL default '0',
  othernum tinyint(3) unsigned NOT NULL default '0',
  flash text NOT NULL default '',
  music text NOT NULL default '',
  choiceblockleft text NOT NULL default '',
  choiceblockright text NOT NULL default '',
  choiceblockmain text NOT NULL default '',
  myblock1 text NOT NULL default '',
  myblock2 text NOT NULL default '',
  myblock3 text NOT NULL default '',
  myblock4 text NOT NULL default '',
  myblock5 text NOT NULL default '',
  layout tinyint(1) unsigned NOT NULL default '1',
  showside tinyint(1) NOT NULL default '0',
  diy text NOT NULL default '',
  PRIMARY KEY  (uid)
) TYPE=MyISAM;

CREATE TABLE supe_userprofile (
  proid smallint(6) unsigned NOT NULL auto_increment,
  available tinyint(1) NOT NULL default '0',
  invisible tinyint(1) NOT NULL default '0',
  title varchar(50) NOT NULL default '',
  description varchar(255) NOT NULL default '',
  size tinyint(3) unsigned NOT NULL default '0',
  required tinyint(1) NOT NULL default '0',
  selective tinyint(1) NOT NULL default '0',
  choices text NOT NULL default '',
  displayorder smallint(6) NOT NULL default '0',
  PRIMARY KEY  (`proid`)
) TYPE=MyISAM;

CREATE TABLE supe_userfields (
  uid mediumint(8) unsigned NOT NULL auto_increment,
  nickname char(30) NOT NULL default '',
  sex char(4) NOT NULL default '',
  birthyear smallint(4) unsigned NOT NULL default '0',
  birthmonth tinyint(2) unsigned NOT NULL default '0',
  birthday tinyint(2) unsigned NOT NULL default '0',
  marriage char(4) NOT NULL default '',
  star char(6)  NOT NULL default '',
  folk char(10) NOT NULL default '',
  bloodtype char(2) NOT NULL default '',
  tall char(14) NOT NULL default '',
  weight tinyint(3) unsigned NOT NULL default '0',
  native char(60) NOT NULL default '',
  figure char(10) NOT NULL default '',
  email char(100) NOT NULL default '',
  email2 char(100) NOT NULL default '',
  email3 char(100) NOT NULL default '',
  qq char(12) NOT NULL default '',
  msn char(100) NOT NULL default '',
  phone char(20) NOT NULL default '',
  mobile char(12) NOT NULL default '',
  address char(100) NOT NULL default '',
  postalcode char(18) NOT NULL default '',
  edu char(12) NOT NULL default '',
  school char(50) NOT NULL default '',
  job char(20) NOT NULL default '',
  position char(20) NOT NULL default '',
  income char(15) NOT NULL default '',
  housing char(15) NOT NULL default '',
  smoke char(15) NOT NULL default '',
  drink char(24) NOT NULL default '',
  interest char(100) NOT NULL default '',
  PRIMARY KEY  (uid)
) TYPE=MyISAM;

CREATE TABLE supe_visitors (
  uid mediumint(8) unsigned NOT NULL default '0',
  visitoruid mediumint(8) unsigned NOT NULL default '0',
  dateline int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (uid,visitoruid),
  KEY uid (uid,dateline)
) TYPE=MyISAM;

INSERT INTO supe_crons (available, type, name, filename, lastrun, nextrun, weekday, day, hour, minute) VALUES (1, 'system', '清理訪客足跡', 'cleanvisitors.php', 1160356169, 1160420400, -1, -1, 3, '0');
INSERT INTO supe_crons (available, type, name, filename, lastrun, nextrun, weekday, day, hour, minute) VALUES (1, 'system', '清理主題足跡', 'cleantracks.php', 1160356169, 1160422200, -1, -1, 3, '30');

ALTER TABLE supe_userspaces ADD photo char(3) NOT NULL;

ALTER TABLE `supe_ads` DROP `shows`;

ALTER TABLE supe_attachments CHANGE `type` `type` char(20) NOT NULL default '';

ALTER TABLE supe_effects CHANGE `name` `name` char(50) NOT NULL default '',
CHANGE `kind` `kind` char(10) NOT NULL default '',
CHANGE `file` `file` char(200) NOT NULL default '';

ALTER TABLE supe_spaceimages ADD image varchar(200) NOT NULL AFTER message,
ADD imagenum smallint(6) NOT NULL default '0' AFTER image;

ALTER TABLE supe_categories CHANGE `name` `name` VARCHAR( 50 ) NOT NULL ,
CHANGE `note` `note` TEXT NOT NULL ,
CHANGE `type` `type` VARCHAR( 15 ) NOT NULL DEFAULT '',
CHANGE `styleid` `tpl` VARCHAR( 80 ) NOT NULL DEFAULT '',
CHANGE `hash` `hash` VARCHAR( 32 ) NOT NULL DEFAULT '',
CHANGE `bbsurltype` `bbsurltype` VARCHAR( 15 ) NOT NULL DEFAULT '',
CHANGE `blockparameter` `blockparameter` TEXT NOT NULL ,
ADD `thumb` VARCHAR(150) NOT NULL AFTER `tpl`,
ADD `image` VARCHAR(150) NOT NULL AFTER `thumb`,
ADD `url` VARCHAR( 200 ) NOT NULL DEFAULT '',
ADD `subcatid` VARCHAR( 200 ) NOT NULL DEFAULT '';

UPDATE supe_categories SET subcatid=catid;

ALTER TABLE supe_rss CHANGE `type` `type` varchar(10) NOT NULL;

ALTER TABLE supe_robotmessages ADD INDEX ( `itemid` ) ;

ALTER TABLE supe_robotitems ADD INDEX ( `robotid` ) ;

ALTER TABLE supe_attachments ADD INDEX ( `itemid` ) ;

ALTER TABLE supe_spacecomments CHANGE `type` `type` varchar(10) NOT NULL;

ALTER TABLE supe_itemtypes CHANGE `type` `type` char(10) NOT NULL default '';

UPDATE supe_spaceitems SET folder='2' WHERE allowpublic='0';

ALTER TABLE supe_spaceitems CHANGE `type` `type` char(10) NOT NULL default '',
DROP `allowpublic`,
DROP `allowpassport`,
DROP `viewcredits`,
DROP `buycredits`;

ALTER TABLE supe_members DROP `credits` ,
DROP `extcredits1` ,
DROP `extcredits2` ,
DROP `extcredits3` ,
DROP `extcredits4` ,
DROP `extcredits5` ,
DROP `extcredits6` ,
DROP `extcredits7` ,
DROP `extcredits8` ,
ADD `lastsearchtime` int(10) unsigned NOT NULL default '0';

ALTER TABLE supe_prefields CHANGE `type` `type` char(10) NOT NULL default '';

ALTER TABLE supe_robots ADD `encode` VARCHAR( 20 ) NOT NULL default '' AFTER `savepic` ;

ALTER TABLE supe_spacefiles CHANGE `version` `version` VARCHAR( 100 ) NOT NULL DEFAULT '',
CHANGE `producer` `producer` VARCHAR( 100 ) NOT NULL DEFAULT '',
CHANGE `downfrom` `downfrom` VARCHAR( 100 ) NOT NULL DEFAULT '',
CHANGE `language` `language` VARCHAR( 100 ) NOT NULL DEFAULT '',
CHANGE `permission` `permission` VARCHAR( 100 ) NOT NULL DEFAULT '',
CHANGE `system` `system` VARCHAR( 100 ) NOT NULL DEFAULT '';

ALTER TABLE supe_spacegoods CHANGE `price` `price` FLOAT UNSIGNED NOT NULL DEFAULT '0',
CHANGE `chargemail` `chargemail` FLOAT UNSIGNED NOT NULL DEFAULT '0',
CHANGE `chargeexpress` `chargeexpress` FLOAT UNSIGNED NOT NULL DEFAULT '0',
CHANGE `chargeems` `chargeems` FLOAT UNSIGNED NOT NULL DEFAULT '0',
ADD markup SMALLINT( 6 ) UNSIGNED NOT NULL DEFAULT '1' ,
ADD starttime INT( 10 ) UNSIGNED NOT NULL DEFAULT '0',
ADD image varchar(150) NOT NULL default '',
ADD thumb varchar(150) NOT NULL default '',
ADD status TINYINT( 1 ) NOT NULL DEFAULT '0' ,
DROP `salednum`;

ALTER TABLE supe_styles CHANGE tplname tplname char(80) NOT NULL default '',
CHANGE tpltype tpltype char(20) default NULL,
CHANGE tplfilepath tplfilepath char(80) NOT NULL default '';

ALTER TABLE `supe_spacenews` DROP PRIMARY KEY ,
ADD INDEX ( `itemid` ),
ADD `nid` MEDIUMINT( 8 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;

ALTER TABLE supe_templatecontents DROP `mainphp`,
DROP `listphp`,
DROP `messagephp`;

ALTER TABLE supe_templateitems DROP `updatetime`,
DROP `hash`,
DROP `price`,
DROP `usenum`,
DROP `isshare`,
DROP `ischeckup`,
DROP `isuse`;

ALTER TABLE `supe_rss` DROP INDEX `uid`, DROP INDEX `type`;

ALTER TABLE `supe_spacelinks` ADD `domain` varchar(150) NOT NULL AFTER url;

ALTER TABLE `supe_usergroups` DROP `tplnum` ,
ADD `allowcorpus` tinyint(1) NOT NULL default '0';

ALTER TABLE `supe_userspaces` CHANGE `domain` `domain` char(20) NOT NULL default '';

REPLACE INTO `supe_settings` VALUES ('allowannounce', 'front,back');
REPLACE INTO `supe_settings` VALUES ('searchinterval', '30');
DELETE FROM `supe_settings` WHERE `variable` = 'htmlitemlisttime';
DELETE FROM `supe_settings` WHERE `variable` = 'htmlitemlist';

DROP TABLE IF EXISTS supe_virtualgoods;

REPLACE INTO supe_settings VALUES ('dbver', '2.0Final');