You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2019/06/26 18:32:42 UTC

[airavata] 01/03: deduplicate user_profile_phone

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch staging
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit f915139137e4f1ee2edb48ada39470b3ad02287b
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Wed Jun 26 14:07:40 2019 -0400

    deduplicate user_profile_phone
---
 .../next/DeltaScripts/profile_service_schema_delta.sql             | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/modules/registry/release-migration-scripts/next/DeltaScripts/profile_service_schema_delta.sql b/modules/registry/release-migration-scripts/next/DeltaScripts/profile_service_schema_delta.sql
index 16af7b3..e0ff787 100644
--- a/modules/registry/release-migration-scripts/next/DeltaScripts/profile_service_schema_delta.sql
+++ b/modules/registry/release-migration-scripts/next/DeltaScripts/profile_service_schema_delta.sql
@@ -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;