-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemplate.sql
87 lines (50 loc) · 1.3 KB
/
template.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
do
$install$
declare _t text;
begin
/* #region init */
if exists(select 1 as name from pg_namespace where nspname = '${this.schema}') then
--drop schema ${this.schema} cascade;
raise exception 'Schema "${this.schema}" already exists. Consider running "drop schema ${this.schema} cascade;" to recreate ${this.schema} schema.';
end if;
create schema schema;
/* #endregion init */
${this.tables}
${this._prepare_params}
${this._get_schema_array}
${this._parse_column}
${this._parse_return}
${this._ident}
${this._parse_routine_body}
${this._create_table_temp_tables}
${this._search_filter}
${this._quote}
${this._aggregates}
${this._ranges}
${this._routines}
${this._routines_order}
${this._constraints}
${this._indexes}
${this._triggers}
${this._policies}
${this._columns}
${this._tables_full}
${this._tables}
${this._views}
${this._views_order}
${this._types}
${this._enums}
${this._domains}
${this._rules}
${this._extensions}
${this._sequences}
${this._temp_exists}
${this.search}
${this.dump}
raise notice 'Schema "${this.schema}" functions installed.';
raise info 'Following public functions are available:';
for _t in (select concat(type, ' ', schema, '.', name) from schema.search('schema', 'function') where name not like '\\_%') loop
raise info '%', _t;
end loop;
end;
$install$;