Yair Zaslavsky has uploaded a new change for review.

Change subject: core: filling blank external_id values
......................................................................

core: filling blank external_id values

The following fills blank external_ids by creating content based on the entity 
ids.
Change-Id: I6d789381ff9e6022479cca1618f8d2a7accc9e71
Bug-url: https://bugzilla.redhat.com/1091380
Signed-off-by: Yair Zaslavsky <[email protected]>
---
M packaging/dbscripts/upgrade/03_04_0730_change_group_ids.sql
M packaging/dbscripts/upgrade/03_04_0740_update_user_ids.sql
2 files changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/28/27228/1

diff --git a/packaging/dbscripts/upgrade/03_04_0730_change_group_ids.sql 
b/packaging/dbscripts/upgrade/03_04_0730_change_group_ids.sql
index 4774f81..ffd4de6 100644
--- a/packaging/dbscripts/upgrade/03_04_0730_change_group_ids.sql
+++ b/packaging/dbscripts/upgrade/03_04_0730_change_group_ids.sql
@@ -2,6 +2,10 @@
 RETURNS VOID
    AS $procedure$
 BEGIN
+
+--If there is no external_id set at users, populate it with content based on 
the id
+update ad_groups set external_id = decode(replace(CAST(id as 
text),'-',''),'HEX') where encode(external_id,'HEX') = '';
+
 --groups.external_id holds a hex representation of the id of groups at ldap 
directories.
 -- This script sets the guid representation at ad_groups.id, and modifies all 
relevant references,
 --using the following steps:
diff --git a/packaging/dbscripts/upgrade/03_04_0740_update_user_ids.sql 
b/packaging/dbscripts/upgrade/03_04_0740_update_user_ids.sql
index 44272c2..a0bb97e 100644
--- a/packaging/dbscripts/upgrade/03_04_0740_update_user_ids.sql
+++ b/packaging/dbscripts/upgrade/03_04_0740_update_user_ids.sql
@@ -2,6 +2,10 @@
 RETURNS VOID
    AS $procedure$
 BEGIN
+
+--If there is no external_id set at users, populate it with content based on 
the user_id
+update users set external_id = decode(replace(CAST(user_id as 
text),'-',''),'HEX') where encode(external_id,'HEX') = '';
+
 --users.external_id holds a hex representation of the id of users at ldap 
directories.
 -- This script sets the guid representation at users.id, and modifies all 
relevant references,
 --using the following steps:


-- 
To view, visit http://gerrit.ovirt.org/27228
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6d789381ff9e6022479cca1618f8d2a7accc9e71
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.4
Gerrit-Owner: Yair Zaslavsky <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to