deduplicate user_profile_phone
@@ -41,6 +41,13 @@ ALTER TABLE `USER_PROFILE_LABELED_URI` ADD PRIMARY KEY IF NOT EXISTS (`AIRAVATA_
ALTER TABLE `USER_PROFILE_LABELED_URI` DROP INDEX IF EXISTS `AIRAVATA_INTERNAL_USER_ID`;
ALTER TABLE `USER_PROFILE_NATIONALITY` ADD PRIMARY KEY IF NOT EXISTS (`AIRAVATA_INTERNAL_USER_ID`,`NATIONALITY`);
ALTER TABLE `USER_PROFILE_NATIONALITY` DROP INDEX IF EXISTS `AIRAVATA_INTERNAL_USER_ID`;
+
+-- deduplicate phone records
+CREATE TABLE USER_PROFILE_PHONE_TEMP SELECT DISTINCT AIRAVATA_INTERNAL_USER_ID, PHONE FROM USER_PROFILE_PHONE;
+TRUNCATE USER_PROFILE_PHONE;
+INSERT INTO USER_PROFILE_PHONE SELECT * FROM USER_PROFILE_PHONE_TEMP;
+DROP TABLE USER_PROFILE_PHONE_TEMP;
+
ALTER TABLE `USER_PROFILE_PHONE` ADD PRIMARY KEY IF NOT EXISTS (`AIRAVATA_INTERNAL_USER_ID`,`PHONE`);
ALTER TABLE `USER_PROFILE_PHONE` DROP INDEX IF EXISTS `AIRAVATA_INTERNAL_USER_ID`;
ALTER TABLE `NSF_DEMOGRAPHIC_DISABILITY` CHANGE `AIRAVATA_INTERNAL_USER_ID` `AIRAVATA_INTERNAL_USER_ID` varchar(255) NOT NULL;
