-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_languages_translations_v1-6.sql
60 lines (54 loc) · 3.62 KB
/
update_languages_translations_v1-6.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
GROUP HEADERS GENERATED BY: https://patorjk.com/software/taag/#p=display&h=0&v=1&c=c&f=ANSI%20Shadow&t=STAGE%20FUNCS
SUB GROUP HEADERS GENERATED BY: https://patorjk.com/software/taag/#p=display&h=1&v=1&c=c&f=Banner3&t=permissions
*/
select *
from start_version_update('1.6', 'Putting back function for extracting translations from database',
_component := 'languages_translations');
/***
* ██╗ █████╗ ███╗ ██╗ ██████╗ ██╗ ██╗ █████╗ ██████╗ ███████╗███████╗
* ██║ ██╔══██╗████╗ ██║██╔════╝ ██║ ██║██╔══██╗██╔════╝ ██╔════╝██╔════╝
* ██║ ███████║██╔██╗ ██║██║ ███╗██║ ██║███████║██║ ███╗█████╗ ███████╗
* ██║ ██╔══██║██║╚██╗██║██║ ██║██║ ██║██╔══██║██║ ██║██╔══╝ ╚════██║
* ███████╗██║ ██║██║ ╚████║╚██████╔╝╚██████╔╝██║ ██║╚██████╔╝███████╗███████║
* ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚══════╝
*
*/
/***
* ████████╗ █████╗ ██████╗ ██╗ ███████╗███████╗
* ╚══██╔══╝██╔══██╗██╔══██╗██║ ██╔════╝██╔════╝
* ██║ ███████║██████╔╝██║ █████╗ ███████╗
* ██║ ██╔══██║██╔══██╗██║ ██╔══╝ ╚════██║
* ██║ ██║ ██║██████╔╝███████╗███████╗███████║
* ╚═╝ ╚═╝ ╚═╝╚═════╝ ╚══════╝╚══════╝╚══════╝
*
*/
/***
* ███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗
* ██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝
* █████╗ ██║ ██║██╔██╗ ██║██║ ███████╗
* ██╔══╝ ██║ ██║██║╚██╗██║██║ ╚════██║
* ██║ ╚██████╔╝██║ ╚████║╚██████╗███████║
* ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚══════╝
*
*/
create or replace function public.export_translations(_data_group text)
returns table
(
__lang_code text,
__translations json,
__count bigint
)
stable
language sql
as
$$
select language_code
, json_object_agg(data_object_code, value)
, count(translation_id)
from translation
where data_group = _data_group
group by language_code
$$;
select *
from stop_version_update('1.6', _component := 'languages_translations');