Yair Zaslavsky has uploaded a new change for review. Change subject: aaa: introducing users_groups relation table ......................................................................
aaa: introducing users_groups relation table This is first step in removing group_ids and groups column from users table Change-Id: I41f2a4a6a744d9d044d76f848870f15e1c78c391 Topic: AAA Signed-off-by: Yair Zaslavsky <[email protected]> --- A packaging/dbscripts/upgrade/03_06_0370_create_users_groups_relation_table.sql 1 file changed, 26 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/23/32823/1 diff --git a/packaging/dbscripts/upgrade/03_06_0370_create_users_groups_relation_table.sql b/packaging/dbscripts/upgrade/03_06_0370_create_users_groups_relation_table.sql new file mode 100644 index 0000000..3bb53ff --- /dev/null +++ b/packaging/dbscripts/upgrade/03_06_0370_create_users_groups_relation_table.sql @@ -0,0 +1,26 @@ +CREATE TABLE users_groups +( + user_id UUID NOT NULL REFERENCES users(user_id) ON DELETE CASCADE, + group_id UUID NOT NULL REFERENCES ad_groups(id) ON DELETE CASCADE +) WITH OIDS; + +CREATE OR REPLACE FUNCTION fnsplitteruuidWithoutEmptyUuid(ids text) + RETURNS SETOF uuid + LANGUAGE plpgsql + IMMUTABLE +AS $function$ +BEGIN + RETURN QUERY select fnsplitterUuid(ids) except select '00000000-0000-0000-0000-000000000000'; +END; $function$; + + +INSERT INTO USERS_GROUPS(user_id, group_id) + SELECT users.user_id AS user_id, fnSplitterUuidWithoutEmptyUuid(users.group_ids) AS group_id +FROM users +UNION ALL +-- user is also member of 'Everyone' +SELECT user_id, 'EEE00000-0000-0000-0000-123456789EEE' +FROM users; + +DROP FUNCTION fnsplitteruuidWithoutEmptyUuid(text); + -- To view, visit http://gerrit.ovirt.org/32823 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I41f2a4a6a744d9d044d76f848870f15e1c78c391 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yair Zaslavsky <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
