hs.hsadmin.ng/src/main/resources/db/changelog/2022-07-28-030-rbac-statistics.sql

25 lines
950 B
MySQL
Raw Normal View History

--liquibase formatted sql
2022-07-22 13:31:37 +02:00
--changeset rbac-statistics:1 endDelimiter:--//
/*
Creates a view which presents some statistics about the RBAC tables.
*/
create view RbacStatisticsView AS
select no, to_char("count", '9 999 999 999') as "count", "table"
from (
2022-07-22 13:31:37 +02:00
select 1 as no, count(*) as "count", 'login users' as "table" from RbacUser
union
2022-07-22 13:31:37 +02:00
select 2 as no, count(*) as "count", 'roles' as "table" from RbacRole
union
2022-07-22 13:31:37 +02:00
select 3 as no, count(*) as "count", 'permissions' as "table" from RbacPermission
union
2022-07-22 13:31:37 +02:00
select 4 as no, count(*) as "count", 'references' as "table" from RbacReference
union
2022-07-22 13:31:37 +02:00
select 5 as no, count(*) as "count", 'grants' as "table" from RbacGrants
union
2022-07-22 13:31:37 +02:00
select 6 as no, count(*) as "count", 'objects' as "table" from RbacObject
) as totals
order by totals.no;
--//