model.anubis
984 Bytes
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
/*
* Created by PyramIDE.
* User: フランスのトトロ aka (David RENÉ)
* Date: 13/02/2016
* Time: 11:01
* © David RENÉ
*/
read system/string.anubis
read hayamiki_lib/types/hayamiki.anubis
public define String
format_attributes
(
List(HK_Model_Attr) attributes
)=
join(" ",map((HK_Model_Attr attr) |->
if attr is
{
unique then "UNIQUE",
default(str) then "DEFAULT "+str, // default value (used in case of creation of a NON NULL column
// in a table which already contains some rows)
not_null then "NOT NULL"
}, attributes)).
public define String
format_fk_clause
(
List(HK_Foreign_Key_Clause) fk_clauses
)=
join(" ",map((HK_Foreign_Key_Clause fk_clause) |->
if fk_clause is
{
on_delete(directive) then "ON DELETE "+to_String(directive),
on_update(directive) then "ON UPDATE "+to_String(directive)
}, fk_clauses
))
.