Skip to content

Commit 355117f

Browse files
authored
Create readme.md
1 parent 1330b9f commit 355117f

File tree

1 file changed

+52
-0
lines changed
  • Background Scripts/Custom Table Usage

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Custom Table Usage Count
2+
3+
This script provides a way of counting where any custom tables (u_) are used in the instance.
4+
5+
Returns JSON object similar to the following:
6+
7+
```json
8+
[
9+
{
10+
"name": "u_cmdb_ci_key_value_staging",
11+
"label": "Key Value Staging",
12+
"references": {
13+
"Dictionary": 0,
14+
"Variables": 0,
15+
"Business Rules": 0,
16+
"Client Scripts": 0,
17+
"Dictionary Entries": 86,
18+
"Dictionary Overrides": 0,
19+
"UI Actions": 0,
20+
"ACL": 0,
21+
"UI Policies": 0,
22+
"Data Policy": 0,
23+
"Styles": 0,
24+
"View Rules": 0,
25+
"Workflows": 0,
26+
"Flows": 0
27+
}
28+
}
29+
]
30+
```
31+
32+
Easily extended by adding more entries in the USAGE_COUNT_CONFIG object.
33+
34+
```javascript
35+
const USAGE_COUNT_CONFIG = [
36+
{ "table": "sys_dictionary", "field": "reference", "title": "Dictionary" },
37+
{ "table": "item_option_new", "field": "reference", "title": "Variables" },
38+
{ "table": "sys_script", "field": "collection", "title": "Business Rules" },
39+
{ "table": "sys_script_client", "field": "table", "title": "Client Scripts" },
40+
{ "table": "sys_dictionary", "field": "name", "title": "Dictionary Entries" },
41+
{ "table": "sys_dictionary_override", "field": "name", "title": "Dictionary Overrides" },
42+
{ "table": "sys_ui_action", "field": "table", "title": "UI Actions" },
43+
{ "table": "sys_security_acl", "field": "name", "title": "ACL", "query": "STARTSWITH" },
44+
{ "table": "sys_ui_policy", "field": "table", "title": "UI Policies", },
45+
{ "table": "sys_data_policy2", "field": "model_table", "title": "Data Policy" },
46+
{ "table": "sys_ui_style", "field": "name", "title": "Styles" },
47+
{ "table": "sysrule_view", "field": "table", "title": "View Rules" },
48+
{ "table": "wf_workflow", "field": "table", "title": "Workflows" },
49+
{ "table": "sys_hub_flow", "field": "sys_id", "title": "Flows", "query": "", "query_field": "sys_id" },
50+
{ "table": "sys_script_include", "field": "script", "title": "Script Include", 'query': 'CONTAINS'}
51+
];
52+
```

0 commit comments

Comments
 (0)