# -----------------------
# Land Down Under v450 > v460 upgrade
# Run this script in phpMyAdmin to update tables
# in your MySQL database
# -----------------------

CREATE TABLE ldu_online (
  online_ip varchar(15) NOT NULL default '',
  online_name varchar(24) NOT NULL default '',
  online_lastseen varchar(16) NOT NULL default '',
  online_id int(11) NOT NULL default '0',
  PRIMARY KEY (online_ip),
  KEY online_lastseen (online_lastseen)
) TYPE=MyISAM; 

CREATE TABLE ldu_ratings (
  rating_id int(11) NOT NULL auto_increment,
  rating_code varchar(16) NOT NULL default '',
  rating_state tinyint(2) NOT NULL default '0',
  rating_average decimal(5,2) NOT NULL default '0',
  rating_creationdate varchar(16) NOT NULL default '',
  rating_text varchar(128) NOT NULL default '',
  PRIMARY KEY (rating_id),
  KEY rating_code (rating_code)
) TYPE=MyISAM;

CREATE TABLE ldu_rated (
  rated_id int(11) unsigned NOT NULL auto_increment,
  rated_code varchar(16) default NULL,
  rated_userid int(11),
  PRIMARY KEY (rated_id),
  KEY rated_code (rated_code)
) TYPE=MyISAM;

ALTER TABLE ldu_com MODIFY COLUMN com_code varchar(16) NOT NULL default '';
ALTER TABLE ldu_com MODIFY COLUMN com_date varchar(16) NOT NULL default '';
ALTER TABLE ldu_com MODIFY COLUMN com_id int(11) NOT NULL;
ALTER TABLE ldu_com DROP PRIMARY KEY;
ALTER TABLE ldu_com ADD PRIMARY KEY (com_id);
ALTER TABLE ldu_com ADD KEY com_code (com_code);
ALTER TABLE ldu_com MODIFY COLUMN com_id int(11) NOT NULL auto_increment;
UPDATE ldu_users SET user_lastlog='' WHERE 1;

ALTER TABLE ldu_com DROP COLUMN com_email;
ALTER TABLE ldu_com ADD COLUMN com_authorid int(11) AFTER com_author;

ALTER TABLE ldu_eventp MODIFY COLUMN eventp_id int(11) NOT NULL auto_increment;
ALTER TABLE ldu_eventp MODIFY COLUMN eventp_eventid int(11) NOT NULL;
ALTER TABLE ldu_eventp MODIFY COLUMN eventp_userid int(11) NOT NULL;



