Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eduGAIN Technical Site
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
edugain
eduGAIN OT
eduGAIN Technical Site
Commits
7a78261e
Commit
7a78261e
authored
8 months ago
by
Tomasz Wolniewicz
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into 'master'
Some more SQL cleanup See merge request
!35
parents
4645d53d
7dfd6a94
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!35
Some more SQL cleanup
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
database/update_role_details.sql
+7
-7
7 additions, 7 deletions
database/update_role_details.sql
with
7 additions
and
7 deletions
database/update_role_details.sql
+
7
−
7
View file @
7a78261e
...
...
@@ -4,11 +4,11 @@ begin
DELETE
FROM
entity_details
;
INSERT
INTO
entity_details
(
entity_id
,
displayname
)
SELECT
entity_id
,
group_concat
(
concat
(
lang
,
';'
,
displayname
)
ORDER
BY
lang
separator
'=='
)
FROM
entity_organization
GROUP
BY
entity_id
;
INSERT
INTO
entity_details
(
entity_id
,
entity_cat
)
SELECT
entity_id
,
group_concat
(
entityattributes_dict_id
separator
';'
)
FROM
entity_attributes
GROUP
BY
entity_id
ON
duplicate
key
UPDATE
entity_cat
=
VALUES
(
entity_cat
);
INSERT
INTO
entity_details
(
entity_id
,
entity_cat
)
SELECT
entity_id
,
group_concat
(
entityattributes_dict_id
separator
';'
)
FROM
entity_attributes
GROUP
BY
entity_id
ON
DUPLICATE
KEY
UPDATE
entity_cat
=
VALUES
(
entity_cat
);
INSERT
INTO
entity_details
(
entity_id
,
saml2_support
)
SELECT
entity_id
,
max
(
saml2
)
AS
saml2_e
FROM
(
SELECT
entity_roles
.
entity_id
AS
entity_id
,
max
(
entity_protocolsupport
.
value
regexp
':2
\\\\
.0:'
)
AS
saml2
FROM
entity_protocolsupport
JOIN
entity_roles
ON
entity_protocolsupport
.
entityrole_id
=
entity_roles
.
id
GROUP
BY
entity_protocolsupport
.
entityrole_id
)
AS
r
GROUP
BY
entity_id
ON
duplicate
key
UPDATE
saml2_support
=
VALUES
(
saml2_support
);
INSERT
INTO
entity_details
(
entity_id
,
saml2_support
)
SELECT
entity_id
,
max
(
saml2
)
AS
saml2_e
FROM
(
SELECT
entity_roles
.
entity_id
AS
entity_id
,
max
(
entity_protocolsupport
.
value
regexp
':2
\\\\
.0:'
)
AS
saml2
FROM
entity_protocolsupport
JOIN
entity_roles
ON
entity_protocolsupport
.
entityrole_id
=
entity_roles
.
id
GROUP
BY
entity_protocolsupport
.
entityrole_id
)
AS
r
GROUP
BY
entity_id
ON
DUPLICATE
KEY
UPDATE
saml2_support
=
VALUES
(
saml2_support
);
INSERT
INTO
entity_details
(
entity_id
,
clash
)
SELECT
entity_id
,
count
(
code
)
FROM
entity_duplication
GROUP
BY
entity_id
ON
duplicate
key
UPDATE
clash
=
VALUES
(
clash
);
INSERT
INTO
entity_details
(
entity_id
,
clash
)
SELECT
entity_id
,
count
(
code
)
FROM
entity_duplication
GROUP
BY
entity_id
ON
DUPLICATE
KEY
UPDATE
clash
=
VALUES
(
clash
);
UPDATE
entity_details
JOIN
entities
ON
entity_details
.
entity_id
=
entities
.
id
JOIN
eccs_stat
ON
entities
.
entityid
=
eccs_stat
.
entityid
set
entity_details
.
eccs_status
=
eccs_stat
.
status
,
entity_details
.
eccs_status_date
=
eccs_stat
.
update_date
;
UPDATE
entity_details
JOIN
entities
ON
entity_details
.
entity_id
=
entities
.
id
JOIN
coco_stat
ON
entities
.
entityid
=
coco_stat
.
entityid
set
entity_details
.
coco_status
=
coco_stat
.
status
,
entity_details
.
coco_id
=
coco_stat
.
coco_id
;
...
...
@@ -35,13 +35,13 @@ INSERT INTO federation_warnings (code,warnings) SELECT mds_data.code, bit_or(ent
DELETE
FROM
role_details
;
INSERT
INTO
role_details
(
entityrole_id
,
entity_id
,
roledesc
)
SELECT
id
,
entity_id
,
roledesc
FROM
entity_roles
;
INSERT
INTO
role_details
(
entityrole_id
,
role_display_name
)
SELECT
entity_roles
.
id
,
group_concat
(
concat
(
entity_info
.
lang
,
';'
,
entity_info
.
value
)
ORDER
BY
lang
separator
'=='
)
FROM
entity_roles
JOIN
entity_info
ON
entity_roles
.
id
=
entityrole_id
WHERE
entity_info
.
type
=
'DisplayName'
GROUP
BY
entity_roles
.
id
ON
duplicate
key
UPDATE
role_display_name
=
VALUES
(
role_display_name
);
INSERT
INTO
role_details
(
entityrole_id
,
role_display_name
)
SELECT
entity_roles
.
id
,
group_concat
(
concat
(
entity_info
.
lang
,
';'
,
entity_info
.
value
)
ORDER
BY
lang
separator
'=='
)
FROM
entity_roles
JOIN
entity_info
ON
entity_roles
.
id
=
entityrole_id
WHERE
entity_info
.
type
=
'DisplayName'
GROUP
BY
entity_roles
.
id
ON
DUPLICATE
KEY
UPDATE
role_display_name
=
VALUES
(
role_display_name
);
INSERT
INTO
role_details
(
entityrole_id
,
role_service_name
)
SELECT
entity_roles
.
id
,
group_concat
(
concat
(
entity_info
.
lang
,
';'
,
entity_info
.
value
)
ORDER
BY
lang
separator
'=='
)
FROM
entity_roles
JOIN
entity_info
ON
entity_roles
.
id
=
entityrole_id
WHERE
entity_info
.
type
=
'ServiceName'
GROUP
BY
entity_roles
.
entity_id
ON
duplicate
key
UPDATE
role_service_name
=
VALUES
(
role_service_name
);
INSERT
INTO
role_details
(
entityrole_id
,
role_service_name
)
SELECT
entity_roles
.
id
,
group_concat
(
concat
(
entity_info
.
lang
,
';'
,
entity_info
.
value
)
ORDER
BY
lang
separator
'=='
)
FROM
entity_roles
JOIN
entity_info
ON
entity_roles
.
id
=
entityrole_id
WHERE
entity_info
.
type
=
'ServiceName'
GROUP
BY
entity_roles
.
entity_id
ON
DUPLICATE
KEY
UPDATE
role_service_name
=
VALUES
(
role_service_name
);
INSERT
INTO
role_details
(
entityrole_id
,
scopes
)
SELECT
entityrole_id
,
group_concat
(
scope
separator
'=='
)
FROM
entity_scopes
GROUP
BY
entityrole_id
ON
duplicate
key
UPDATE
scopes
=
VALUES
(
scopes
);
INSERT
INTO
role_details
(
entityrole_id
,
scopes
)
SELECT
entityrole_id
,
group_concat
(
scope
separator
'=='
)
FROM
entity_scopes
GROUP
BY
entityrole_id
ON
DUPLICATE
KEY
UPDATE
scopes
=
VALUES
(
scopes
);
INSERT
INTO
entity_details
(
entity_id
,
roles
)
SELECT
entity_id
,
sum
(
role_code
)
AS
entity_roles
FROM
role_details
JOIN
role_names
ON
role_details
.
roledesc
=
role_names
.
roledesc
GROUP
BY
entity_id
ON
duplicate
key
UPDATE
roles
=
VALUES
(
roles
);
INSERT
INTO
entity_details
(
entity_id
,
roles
)
SELECT
entity_id
,
sum
(
role_code
)
AS
entity_roles
FROM
role_details
JOIN
role_names
ON
role_details
.
roledesc
=
role_names
.
roledesc
GROUP
BY
entity_id
ON
DUPLICATE
KEY
UPDATE
roles
=
VALUES
(
roles
);
DELETE
FROM
entity_fulltext_index
WHERE
entity_id
NOT
IN
(
SELECT
id
FROM
entities
);
DELETE
FROM
entity_fulltext_index
WHERE
entity_id
in
(
SELECT
id
FROM
entities
WHERE
modified
=
1
);
INSERT
INTO
entity_fulltext_index
(
entity_id
,
txt
)
SELECT
id
,
ExtractValue
(
entity_txt
,
'//*[not(self::ds:X509Certificate) and not(self::mdui:Logo)]'
)
FROM
entities
WHERE
modified
=
1
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment