# -----------------------------------------------------------------
# Convert older WebLib installations to updated format
#
# This will update application databases to 
# the 5 November 2003 table format
#
# Last modified: 		5 November 2003
# -----------------------------------------------------------------

ALTER TABLE weblib_users ADD COLUMN active tinyint unsigned not null;
ALTER TABLE weblib_users ADD COLUMN confirmed_on int null;
ALTER TABLE weblib_users ADD COLUMN confirmation_key char(32) null;
ALTER TABLE weblib_users MODIFY COLUMN user_id varchar(255) not null;

CREATE UNIQUE INDEX u_confirmation_key ON weblib_users(confirmation_key);

UPDATE weblib_users SET active = 1;

ALTER TABLE weblib_history MODIFY COLUMN user_id varchar(255) not null;