
--------------------------------------------------
-- 06/10/2020
-- Author: Tony Chen 
-- Following changes are made to integrade with 
-- PHOENIX system.
--------------------------------------------------

ALTER TABLE `users` 
ADD COLUMN `SALT` VARCHAR(255) NULL AFTER `PASSWORD`,
CHANGE COLUMN `USERNAME` `USERNAME` VARCHAR(255) NOT NULL AFTER `LAST_NAME`,
CHANGE COLUMN `EMAIL` `EMAIL` VARCHAR(200) NOT NULL AFTER `SALT`,
CHANGE COLUMN `AREA_CODE` `AREA_CODE` VARCHAR(10) NULL DEFAULT NULL AFTER `EMAIL`,
CHANGE COLUMN `STREET_ADDRESS` `STREET_ADDRESS` VARCHAR(255) NULL DEFAULT NULL AFTER `PHONE_NUMBER`,
CHANGE COLUMN `CITY` `CITY` VARCHAR(100) NULL DEFAULT NULL AFTER `STREET_ADDRESS`,
CHANGE COLUMN `COUNTRY` `COUNTRY` VARCHAR(50) NULL DEFAULT NULL AFTER `ZIP_CODE`,
CHANGE COLUMN `MAILCODE` `MAILCODE` VARCHAR(10) NULL DEFAULT NULL AFTER `COUNTRY`,
CHANGE COLUMN `INSTITUTION` `INSTITUTION` VARCHAR(255) NULL DEFAULT NULL AFTER `MAILCODE`,
CHANGE COLUMN `UMBRELLA_APPNAME` `UMBRELLA_APPNAME` VARCHAR(30) NOT NULL DEFAULT '' AFTER `INSTITUTION`,
CHANGE COLUMN `ROLE` `ROLE` VARCHAR(50) NOT NULL AFTER `UMBRELLA_APPNAME`,
CHANGE COLUMN `WEBSITE_URL` `WEBSITE_URL` VARCHAR(255) NULL DEFAULT NULL AFTER `ACTIVATION_SENT`,
CHANGE COLUMN `LAST_LOGIN` `LAST_LOGIN` DATETIME NULL DEFAULT NULL AFTER `WEBSITE_URL`,
CHANGE COLUMN `COMMENT` `COMMENT` VARCHAR(255) NULL DEFAULT NULL AFTER `DATE_CREATED`,
CHANGE COLUMN `PASSWORD` `PASSWORD` VARCHAR(255) NOT NULL ;
-- --------------------------------------------------

INSERT INTO `version` (`VERSION`, `LAST_MODIFIED_TIME`) VALUES 
    ('2020-06-10', NOW())
;
-- --------------------------------------------------
