Commit 20d4ed207e52b9e144580a8c76693925f529006b

Authored by totoro
1 parent 1a0e85ff

add table constraint on model definition

add mobile and url field
calexium_lib @ b3254dcbe86
1 -Subproject commit 07f1bbce4bbd814d97625f59577e98fc4f8eceea 1 +Subproject commit b3254dcbe8651bb63cc91b71934155fd560bf621
ds_files/20170524-graphviz.pdf 0 → 100644
No preview for this file type
ds_files/graphviz.pdf 0 → 100644
No preview for this file type
hayamiki_generator.aproj
@@ -37,6 +37,7 @@ @@ -37,6 +37,7 @@
37 <Compile Include="calexium_lib\database\db_update_fields.anubis" /> 37 <Compile Include="calexium_lib\database\db_update_fields.anubis" />
38 <Compile Include="calexium_lib\database\db_types.anubis" /> 38 <Compile Include="calexium_lib\database\db_types.anubis" />
39 <Compile Include="calexium_lib\database\db_utils.anubis" /> 39 <Compile Include="calexium_lib\database\db_utils.anubis" />
  40 + <Compile Include="calexium_lib\database\db_version.anubis" />
40 <Compile Include="calexium_lib\database\migration.anubis" /> 41 <Compile Include="calexium_lib\database\migration.anubis" />
41 <Compile Include="calexium_lib\database\migration_common.anubis" /> 42 <Compile Include="calexium_lib\database\migration_common.anubis" />
42 <Compile Include="calexium_lib\database\migration_common_sqlite3.anubis" /> 43 <Compile Include="calexium_lib\database\migration_common_sqlite3.anubis" />
@@ -68,6 +69,7 @@ @@ -68,6 +69,7 @@
68 <Compile Include="calexium_lib\net_services_protocols\pkg_updater_protocol.anubis" /> 69 <Compile Include="calexium_lib\net_services_protocols\pkg_updater_protocol.anubis" />
69 <Compile Include="calexium_lib\os_tools\freebsd\rc_conf.anubis" /> 70 <Compile Include="calexium_lib\os_tools\freebsd\rc_conf.anubis" />
70 <Compile Include="calexium_lib\os_tools\linux\config\network_interface_file.anubis" /> 71 <Compile Include="calexium_lib\os_tools\linux\config\network_interface_file.anubis" />
  72 + <Compile Include="calexium_lib\types\version.anubis" />
71 <Compile Include="calexium_lib\unit_test\xml_rpc.unit_test.anubis" /> 73 <Compile Include="calexium_lib\unit_test\xml_rpc.unit_test.anubis" />
72 <Compile Include="calexium_lib\web\counter.anubis" /> 74 <Compile Include="calexium_lib\web\counter.anubis" />
73 <Compile Include="calexium_lib\web\CXM_common.anubis" /> 75 <Compile Include="calexium_lib\web\CXM_common.anubis" />
@@ -712,6 +714,7 @@ @@ -712,6 +714,7 @@
712 <Folder Include="calexium_lib\os_tools\freebsd" /> 714 <Folder Include="calexium_lib\os_tools\freebsd" />
713 <Folder Include="calexium_lib\os_tools\linux" /> 715 <Folder Include="calexium_lib\os_tools\linux" />
714 <Folder Include="calexium_lib\os_tools\linux\config" /> 716 <Folder Include="calexium_lib\os_tools\linux\config" />
  717 + <Folder Include="calexium_lib\types" />
715 <Folder Include="calexium_lib\unit_test" /> 718 <Folder Include="calexium_lib\unit_test" />
716 <Folder Include="calexium_lib\web" /> 719 <Folder Include="calexium_lib\web" />
717 <Folder Include="calexium_lib\web\jQuery" /> 720 <Folder Include="calexium_lib\web\jQuery" />
hayamiki_lib @ c0af45f7cc7
1 -Subproject commit 57345f2acee9ffeb19673b957d0aeb7296dfb742 1 +Subproject commit c0af45f7cc7c251cbac2837e95cdb7bea2379d95
@@ -164,7 +164,7 @@ define Maybe(List(HK_Table)) @@ -164,7 +164,7 @@ define Maybe(List(HK_Table))
164 [] then success(reverse(so_far)), 164 [] then success(reverse(so_far)),
165 [h . t] then 165 [h . t] then
166 since h is hk_table(name, short_name, model, display), 166 since h is hk_table(name, short_name, model, display),
167 - since model is hk_model(columns, display_string), 167 + since model is hk_model(columns, constraints, display_string),
168 with table_name = if length(app_name) > 0 then app_name +"_"+name else name, 168 with table_name = if length(app_name) > 0 then app_name +"_"+name else name,
169 if resolve_foreign(apps_name, app_name, table_name, columns, []) is 169 if resolve_foreign(apps_name, app_name, table_name, columns, []) is
170 { 170 {
@@ -175,7 +175,7 @@ define Maybe(List(HK_Table)) @@ -175,7 +175,7 @@ define Maybe(List(HK_Table))
175 { 175 {
176 failure then failure, 176 failure then failure,
177 success(checked_list_edits) then 177 success(checked_list_edits) then
178 - resolve_foreign(apps_name, app_name, t, [hk_table(table_name, name, hk_model(checked_model, display_string), hk_display(list_views, checked_list_edits)) . so_far]) 178 + resolve_foreign(apps_name, app_name, t, [hk_table(table_name, name, hk_model(checked_model, constraints, display_string), hk_display(list_views, checked_list_edits)) . so_far])
179 } 179 }
180 180
181 } 181 }
src/generation/SQL_get_all.anubis
@@ -17,7 +17,7 @@ public define Maybe(One) @@ -17,7 +17,7 @@ public define Maybe(One)
17 HK_Table table 17 HK_Table table
18 )= 18 )=
19 since table is hk_table(name, short_name, model, _), 19 since table is hk_table(name, short_name, model, _),
20 - since model is hk_model(columns, _), 20 + since model is hk_model(columns, constraints, _),
21 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 21 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
22 22
23 //generate the type of the table that contain all components 23 //generate the type of the table that contain all components
@@ -74,7 +74,7 @@ public define Maybe(One) @@ -74,7 +74,7 @@ public define Maybe(One)
74 HK_Table table 74 HK_Table table
75 )= 75 )=
76 since table is hk_table(name, short_name, model, _), 76 since table is hk_table(name, short_name, model, _),
77 - since model is hk_model(columns, _), 77 + since model is hk_model(columns, constraints, _),
78 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 78 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
79 79
80 //generate the type of the table that contain all components 80 //generate the type of the table that contain all components
src/generation/SQL_get_count.anubis
@@ -19,7 +19,7 @@ public define Maybe(One) @@ -19,7 +19,7 @@ public define Maybe(One)
19 HK_Table table 19 HK_Table table
20 )= 20 )=
21 since table is hk_table(name, short_name, model, _), 21 since table is hk_table(name, short_name, model, _),
22 - since model is hk_model(columns, _), 22 + since model is hk_model(columns, constraints, _),
23 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 23 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
24 24
25 //generate the type of the table that contain all components 25 //generate the type of the table that contain all components
src/generation/choices_selector.anubis
@@ -80,7 +80,7 @@ public define Maybe(One) @@ -80,7 +80,7 @@ public define Maybe(One)
80 HK_Table table 80 HK_Table table
81 )= 81 )=
82 since table is hk_table(table_name, short_name, model, _), 82 since table is hk_table(table_name, short_name, model, _),
83 - since model is hk_model( columns, show_string), 83 + since model is hk_model( columns, constraints, show_string),
84 84
85 map_forget((HK_Model_Column column) |-> 85 map_forget((HK_Model_Column column) |->
86 since column is hk_column(column_name, field_type, _, _), 86 since column is hk_column(column_name, field_type, _, _),
src/generation/columns.anubis
@@ -109,8 +109,8 @@ public define List(String) @@ -109,8 +109,8 @@ public define List(String)
109 { 109 {
110 [] then reverse(so_far), 110 [] then reverse(so_far),
111 [h . t ] then 111 [h . t ] then
112 - since h is hk_column(name, col_type, _, _),  
113 - with result = to_Bind(col_type, type_name, name, insert), 112 + since h is hk_column(name, col_type, attributes, _),
  113 + with result = to_Bind(col_type, attributes, type_name, name, insert),
114 //we eliminate the empty string because during the join it will have an empty line 114 //we eliminate the empty string because during the join it will have an empty line
115 if result = "" then 115 if result = "" then
116 to_Bind_list(t, type_name, so_far, insert) 116 to_Bind_list(t, type_name, so_far, insert)
@@ -164,6 +164,8 @@ public define Maybe(String) @@ -164,6 +164,8 @@ public define Maybe(String)
164 text_field(_) then success(name), 164 text_field(_) then success(name),
165 color_field then success(name), 165 color_field then success(name),
166 phone_field then success(name), 166 phone_field then success(name),
  167 + mobile_field then success(name),
  168 + url_field then success(name),
167 email_field then success(name) 169 email_field then success(name)
168 }. 170 }.
169 171
@@ -287,6 +289,8 @@ public define Maybe(String) @@ -287,6 +289,8 @@ public define Maybe(String)
287 text_field(txt_attr) then success("text_area(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(txt_attr)+", "+to_Anubis_source(help)+")"), 289 text_field(txt_attr) then success("text_area(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(txt_attr)+", "+to_Anubis_source(help)+")"),
288 color_field then success("color(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"), 290 color_field then success("color(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"),
289 phone_field then success("phone(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"), 291 phone_field then success("phone(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"),
  292 + mobile_field then success("mobile_phone(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"),
  293 + url_field then success("url(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"),
290 email_field then success("email(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"), 294 email_field then success("email(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"),
291 }. 295 }.
292 296
@@ -336,9 +340,11 @@ public define String @@ -336,9 +340,11 @@ public define String
336 float_field then "float_to_string("+current_type_name+"."+name+",5)", 340 float_field then "float_to_string("+current_type_name+"."+name+",5)",
337 char_field(_,_) then current_type_name+"."+name, 341 char_field(_,_) then current_type_name+"."+name,
338 password_field(_) then current_type_name+"."+name, 342 password_field(_) then current_type_name+"."+name,
339 - text_field(_) then current_type_name+"."+name  
340 - color_field then current_type_name+"."+name  
341 - phone_field then current_type_name+"."+name 343 + text_field(_) then current_type_name+"."+name,
  344 + color_field then current_type_name+"."+name,
  345 + phone_field then current_type_name+"."+name,
  346 + mobile_field then current_type_name+"."+name,
  347 + url_field then current_type_name+"."+name,
342 email_field then current_type_name+"."+name 348 email_field then current_type_name+"."+name
343 }. 349 }.
344 350
src/generation/create_table.anubis
@@ -65,12 +65,50 @@ define String @@ -65,12 +65,50 @@ define String
65 . 65 .
66 66
67 define String 67 define String
  68 + to_String
  69 + (
  70 + HK_On_Conflict on_conflict
  71 + )=
  72 + if on_conflict is
  73 + {
  74 + rollback then "ROLLBACK",
  75 + abort then "ABORT",
  76 + fail then "FAIL",
  77 + ignore then "IGNORE",
  78 + replace then "REPLACE"
  79 + }
  80 +.
  81 +
  82 +define String
  83 + create_table_generate_one_constraint
  84 + (
  85 + HK_Constraint constraint,
  86 + String indent
  87 + )=
  88 + since constraint is unique(_name, columns, _on_conflict),
  89 + with name = if _name = "" then "" else "CONSTRAINT "+_name+" ",
  90 + indent+name+"UNIQUE ("+
  91 + indent+indent+join(",\n"+indent+indent, columns)+"\n"+
  92 + indent+")"+
  93 + indent+"ON CONFLICT "+to_String(_on_conflict)
  94 +.
  95 +
  96 +define String
  97 + create_table_generate_constraints
  98 + (
  99 + List(HK_Constraint) constraints,
  100 + String indent
  101 + )=
  102 + join(",\n"+indent, map((HK_Constraint constraint) |-> create_table_generate_one_constraint(constraint, indent), constraints))
  103 +.
  104 +
  105 +define String
68 create_table_generate_one_table 106 create_table_generate_one_table
69 ( 107 (
70 HK_Table table 108 HK_Table table
71 )= 109 )=
72 since table is hk_table(name, short_name, model, display), 110 since table is hk_table(name, short_name, model, display),
73 - since model is hk_model( columns, _), 111 + since model is hk_model( columns, constraints, _),
74 112
75 "\n"+ 113 "\n"+
76 " // "+to_upper(name)+"\n"+ 114 " // "+to_upper(name)+"\n"+
@@ -78,6 +116,7 @@ define String @@ -78,6 +116,7 @@ define String
78 "\"CREATE TABLE "+name+" (\n"+ 116 "\"CREATE TABLE "+name+" (\n"+
79 //columns 117 //columns
80 " "+create_table_generate_columns([hk_column("id",p_key) . columns], " ")+ 118 " "+create_table_generate_columns([hk_column("id",p_key) . columns], " ")+
  119 + create_table_generate_constraints(constraints, " ")+
81 "\n)\".\n" 120 "\n)\".\n"
82 . 121 .
83 122
@@ -124,23 +163,24 @@ define String @@ -124,23 +163,24 @@ define String
124 public define Maybe(One) 163 public define Maybe(One)
125 generate_create_table 164 generate_create_table
126 ( 165 (
127 - List(HK_App) apps, //list of the table model description  
128 - String dest_dir 166 + List(HK_App) apps, //list of the table model description
  167 + String dest_dir,
  168 + String version,
  169 + String _sha1
129 )= 170 )=
130 - //TODO manage version  
131 - with version = "1.0.0.0",  
132 - version_str = find_and_replace(version,".","_"), //replace the dot by underscore because dot is not allowed in function name by Anubis language 171 +
  172 + with version_str = find_and_replace(version,".","_"), //replace the dot by underscore because dot is not allowed in function name by Anubis language
133 173
134 with file_name = dest_dir+"database/generated/migration/to_"+version+".anubis", 174 with file_name = dest_dir+"database/generated/migration/to_"+version+".anubis",
135 - with script_file_name = dest_dir+"database/generated/migration/to_"+version+"_scripts.anubis",  
136 - 175 + with create_file_name = dest_dir+"database/generated/migration/to_"+version+"_create.anubis",
  176 + //with script_file_name = dest_dir+"database/generated/migration/to_"+version+"_SQL.anubis",
137 //create all necessary directories if doesn't exist. 177 //create all necessary directories if doesn't exist.
138 make_directories(file_name); 178 make_directories(file_name);
139 179
140 //create script file name as new file. Previous file with same name will be erased 180 //create script file name as new file. Previous file with same name will be erased
141 - if file(script_file_name, new) is 181 + if file(create_file_name, new) is
142 { 182 {
143 - failure then println("Can't create script "+script_file_name);failure, 183 + failure then println("Can't create script "+create_file_name);failure,
144 success(fd_script) then 184 success(fd_script) then
145 with script_stream = make_stream(fd_script), 185 with script_stream = make_stream(fd_script),
146 //write into script file the generated create table 186 //write into script file the generated create table
@@ -150,6 +190,10 @@ public define Maybe(One) @@ -150,6 +190,10 @@ public define Maybe(One)
150 * Date: "+_Int_to_ISO_8601_date(now)+" 190 * Date: "+_Int_to_ISO_8601_date(now)+"
151 * Time: "+_Int_to_ISO_8601_time(now)+" 191 * Time: "+_Int_to_ISO_8601_time(now)+"
152 */ 192 */
  193 +
  194 +read system/logger.anubis
  195 +read calexium_lib/net_services_protocols/logger_service.anubis
  196 +read calexium_lib/database/migration_common_sqlite3.anubis
153 read data_base/sqlite_foreign_key.anubis 197 read data_base/sqlite_foreign_key.anubis
154 read data_base/db_types.anubis\n"+ 198 read data_base/db_types.anubis\n"+
155 //call the generation of all tables 199 //call the generation of all tables
@@ -158,12 +202,40 @@ read data_base/db_types.anubis\n&quot;+ @@ -158,12 +202,40 @@ read data_base/db_types.anubis\n&quot;+
158 "\npublic define List(String) db_indexes = [].\n"+ 202 "\npublic define List(String) db_indexes = [].\n"+
159 "// ///////////////////////////////\n"+ 203 "// ///////////////////////////////\n"+
160 "// Foreign keys \n"+ 204 "// Foreign keys \n"+
161 - "public define List((String, String, String, String, FK_Null, FK_Cascade)) db_relations = [].\n" 205 + "public define List((String, String, String, String, FK_Null, FK_Cascade)) db_relations = [].\n\n\n
  206 +define String _version = \""+version+"\".
  207 +
  208 +public define Maybe(One)
  209 + create_v"+version_str+"_tables
  210 + (
  211 + SQLite3DataBase db,
  212 + Logger logger_debug
  213 + )=
  214 + if drop_all_triggers(db, logger_debug) is failure then failure else
  215 +
  216 + with tables = (List(DbTable)) [
  217 +"+generate_all_tables_list(apps, " ")+"
  218 + ],
  219 + if create_tables(db, logger_debug, tables, _version) is
  220 + {
  221 + failure then failure,
  222 + success(_) then
  223 + if make_foreign_keys(db, logger_debug, db_relations, _version) is failure then failure else
  224 + success(unique)
  225 + }
  226 +.
  227 +
  228 +public define DB_Version db_model_version = db_version(\""+version+"\", \""+_sha1+"\").
  229 +\n\n"
  230 +
162 ) is 231 ) is
163 { 232 {
164 - failure then println ("Can't generate script "+script_file_name);failure, 233 + failure then println ("Can't generate script "+create_file_name);failure,
165 success(_) then 234 success(_) then
166 //create file with create table management (alter_table, etc...) 235 //create file with create table management (alter_table, etc...)
  236 + if file_exists(file_name) then
  237 + success(println("Skip creation of "+file_name+" because it's already exists and preventing to erase custom migration stuff"))
  238 + else
167 if file(file_name, new) is 239 if file(file_name, new) is
168 { 240 {
169 failure then println("can't create file "+file_name);failure, 241 failure then println("can't create file "+file_name);failure,
@@ -183,6 +255,7 @@ read data_base/db_tools.anubis @@ -183,6 +255,7 @@ read data_base/db_tools.anubis
183 255
184 read calexium_lib/database/db_utils.anubis 256 read calexium_lib/database/db_utils.anubis
185 read calexium_lib/database/migration_common_sqlite3.anubis 257 read calexium_lib/database/migration_common_sqlite3.anubis
  258 +read calexium_lib/database/migration_sqlite3.anubis
186 read calexium_lib/net_services_protocols/logger_service.anubis 259 read calexium_lib/net_services_protocols/logger_service.anubis
187 read data_base/alter_table.anubis 260 read data_base/alter_table.anubis
188 261
@@ -190,28 +263,9 @@ read types/app_types.anubis @@ -190,28 +263,9 @@ read types/app_types.anubis
190 read app/app_constants.anubis 263 read app/app_constants.anubis
191 read app/app_loggers.anubis 264 read app/app_loggers.anubis
192 265
193 -read database/generated/migration/to_"+version+"_scripts.anubis 266 +read database/generated/migration/to_"+version+"_create.anubis
194 267
195 define String _version = \""+version+"\". 268 define String _version = \""+version+"\".
196 -  
197 -public define Maybe(One)  
198 - create_v"+version_str+"_tables  
199 - (  
200 - SQLite3DataBase db,  
201 - Logger logger_debug  
202 - )=  
203 - if drop_all_triggers(db, logger_debug) is failure then failure else  
204 -  
205 - with tables = (List(DbTable)) [  
206 -"+generate_all_tables_list(apps, " ")+"  
207 - ],  
208 - if create_tables(db, logger_debug, tables, _version) is  
209 - {  
210 - failure then failure,  
211 - success(_) then  
212 - if make_foreign_keys(db, logger_debug, db_relations, _version) is failure then failure else  
213 - success(unique)  
214 - }.  
215 269
216 public define Maybe(One) 270 public define Maybe(One)
217 create_v"+version_str+"_indexes 271 create_v"+version_str+"_indexes
@@ -243,12 +297,17 @@ public define Maybe(One) @@ -243,12 +297,17 @@ public define Maybe(One)
243 SQLite3DataBase db, 297 SQLite3DataBase db,
244 Logger logger, 298 Logger logger,
245 )= 299 )=
246 - if to_v"+version_str+"_pre(db, logger) is failure then failure 300 + if to_v"+version_str+"_pre(db, logger) is failure then failure
247 else if create_v"+version_str+"_tables(db, logger) is failure then failure 301 else if create_v"+version_str+"_tables(db, logger) is failure then failure
248 - else if to_v"+version_str+"_post(db, logger) is failure then failure  
249 - else create_v"+version_str+"_indexes(db, logger). 302 + else if to_v"+version_str+"_post(db, logger) is failure then failure
  303 + else create_v"+version_str+"_indexes(db, logger)
  304 +.
250 305
251 - 306 +global define Migration
  307 + migration_to_v"+version_str+"
  308 + =
  309 + migration(db_model_version, migrate_to_v"+version_str+", create_v"+version_str+"_tables, create_v"+version_str+"_indexes)
  310 +.
252 ") 311 ")
253 }}} 312 }}}
254 . 313 .
src/generation/densaku.anubis
@@ -37,7 +37,7 @@ public define Maybe(One) @@ -37,7 +37,7 @@ public define Maybe(One)
37 HK_Table table 37 HK_Table table
38 )= 38 )=
39 since table is hk_table(name, short_name, model, display), 39 since table is hk_table(name, short_name, model, display),
40 - since model is hk_model(columns, show_string), 40 + since model is hk_model(columns, constraints, show_string),
41 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 41 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
42 42
43 //generate the type of the HK_Table that contain all components 43 //generate the type of the HK_Table that contain all components
src/generation/edit_view_list_form.anubis
@@ -43,7 +43,7 @@ public define Maybe(One) @@ -43,7 +43,7 @@ public define Maybe(One)
43 List(HK_FK_View) l_fk_view //List of foreign key view to display 43 List(HK_FK_View) l_fk_view //List of foreign key view to display
44 )= 44 )=
45 since table is hk_table(table_name, short_name, model, display), 45 since table is hk_table(table_name, short_name, model, display),
46 - since model is hk_model( columns, _), 46 + since model is hk_model( columns, constraints, _),
47 with type_name = to_upper(table_name, 1), //make the first character to upper case and be an Anubis Type. 47 with type_name = to_upper(table_name, 1), //make the first character to upper case and be an Anubis Type.
48 48
49 if write_string(stream, 49 if write_string(stream,
src/generation/edit_view_table_form.anubis
@@ -129,7 +129,7 @@ public define Maybe(One) @@ -129,7 +129,7 @@ public define Maybe(One)
129 HK_Editor_Table form_in_table //edit view to generate 129 HK_Editor_Table form_in_table //edit view to generate
130 )= 130 )=
131 since table is hk_table(table_name, short_name, model, display), 131 since table is hk_table(table_name, short_name, model, display),
132 - since model is hk_model( columns, _), 132 + since model is hk_model( columns, constraints, _),
133 with type_name = to_upper(table_name, 1), //make the first character to upper case and be an Anubis Type. 133 with type_name = to_upper(table_name, 1), //make the first character to upper case and be an Anubis Type.
134 134
135 //generate the type of the table that contain all components 135 //generate the type of the table that contain all components
src/generation/extractor.anubis
@@ -33,6 +33,8 @@ public define String @@ -33,6 +33,8 @@ public define String
33 text_field(_) then "text"+cursor_index, 33 text_field(_) then "text"+cursor_index,
34 color_field then "text"+cursor_index, 34 color_field then "text"+cursor_index,
35 phone_field then "text"+cursor_index, 35 phone_field then "text"+cursor_index,
  36 + mobile_field then "text"+cursor_index,
  37 + url_field then "text"+cursor_index,
36 email_field then "text"+cursor_index 38 email_field then "text"+cursor_index
37 }. 39 }.
38 40
@@ -73,7 +75,7 @@ public define Maybe(One) @@ -73,7 +75,7 @@ public define Maybe(One)
73 HK_Table table 75 HK_Table table
74 )= 76 )=
75 since table is hk_table(name, short_name, model, display), 77 since table is hk_table(name, short_name, model, display),
76 - since model is hk_model(columns, _), 78 + since model is hk_model(columns, constraint, _),
77 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 79 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
78 80
79 //generate the type of the table that contain all components 81 //generate the type of the table that contain all components
@@ -168,7 +170,7 @@ public define Maybe(One) @@ -168,7 +170,7 @@ public define Maybe(One)
168 HK_Table table 170 HK_Table table
169 )= 171 )=
170 since table is hk_table(name, short_name, model, display), 172 since table is hk_table(name, short_name, model, display),
171 - since model is hk_model(columns, _), 173 + since model is hk_model(columns, constraints, _),
172 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 174 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
173 175
174 //generate the type of the table that contain all components 176 //generate the type of the table that contain all components
@@ -204,8 +206,9 @@ public define Maybe(One) @@ -204,8 +206,9 @@ public define Maybe(One)
204 " json_object(\n"+ 206 " json_object(\n"+
205 " map(((Int -> SQLite3Datum) -> JsonMember extractor) |-> extractor(cursor) , extractors)\n"+ 207 " map(((Int -> SQLite3Datum) -> JsonMember extractor) |-> extractor(cursor) , extractors)\n"+
206 " ))\n"+ 208 " ))\n"+
207 - " }\n.\n"+ 209 + " }\n.\n\n"+
208 210
  211 +"public define String get_"+name+"_show_string(SQLite3DataBase db, DB_id _idx).\n\n"+
209 "define (Int -> SQLite3Datum) -> JsonMember\n"+ 212 "define (Int -> SQLite3Datum) -> JsonMember\n"+
210 " get_extractor\n"+ 213 " get_extractor\n"+
211 " (\n"+ 214 " (\n"+
src/generation/fields.anubis
@@ -38,6 +38,8 @@ public define String @@ -38,6 +38,8 @@ public define String
38 text_field(_) then "String", 38 text_field(_) then "String",
39 color_field then "String", 39 color_field then "String",
40 phone_field then "String", 40 phone_field then "String",
  41 + mobile_field then "String",
  42 + url_field then "String",
41 email_field then "String" 43 email_field then "String"
42 }. 44 }.
43 45
@@ -62,7 +64,9 @@ public define String @@ -62,7 +64,9 @@ public define String
62 password_field(_) then "string", 64 password_field(_) then "string",
63 text_field(_) then "string", 65 text_field(_) then "string",
64 color_field then "string", 66 color_field then "string",
65 - phone_field then "string" 67 + phone_field then "string",
  68 + mobile_field then "String",
  69 + url_field then "String",
66 email_field then "string" 70 email_field then "string"
67 }. 71 }.
68 72
@@ -95,6 +99,8 @@ public define String @@ -95,6 +99,8 @@ public define String
95 text_field(_) then fill("TEXT", 15) + format_attributes(attributes), 99 text_field(_) then fill("TEXT", 15) + format_attributes(attributes),
96 color_field then fill("VARCHAR(8)",15)+ format_attributes(attributes), 100 color_field then fill("VARCHAR(8)",15)+ format_attributes(attributes),
97 phone_field then fill("VARCHAR(20)", 15) + format_attributes(attributes), 101 phone_field then fill("VARCHAR(20)", 15) + format_attributes(attributes),
  102 + mobile_field then fill("VARCHAR(20)", 15) + format_attributes(attributes),
  103 + url_field then fill("VARCHAR(2048)", 15) + format_attributes(attributes),
98 email_field then fill("VARCHAR(254)", 15) + format_attributes(attributes), 104 email_field then fill("VARCHAR(254)", 15) + format_attributes(attributes),
99 }. 105 }.
100 106
@@ -120,7 +126,9 @@ public define String @@ -120,7 +126,9 @@ public define String
120 text_field(_) then "\"\"", 126 text_field(_) then "\"\"",
121 color_field then "\"#DDD\"", 127 color_field then "\"#DDD\"",
122 phone_field then "\"\"", 128 phone_field then "\"\"",
123 - email_field then "\"\"" 129 + mobile_field then "\"\"",
  130 + url_field then "\"\"",
  131 + email_field then "\"\""
124 }. 132 }.
125 133
126 134
@@ -130,11 +138,13 @@ public define String @@ -130,11 +138,13 @@ public define String
130 public define String 138 public define String
131 to_Bind 139 to_Bind
132 ( 140 (
133 - HK_Model_Field t,  
134 - String type_name, //name of the type  
135 - String name, //name of component into the type  
136 - Bool insert //true if insert time else false for update 141 + HK_Model_Field t,
  142 + List(HK_Model_Attr) attributes,
  143 + String type_name, //name of the type
  144 + String name, //name of component into the type
  145 + Bool insert //true if insert time else false for update
137 ) = 146 ) =
  147 + with or_null = if not_null:attributes then "" else "_or_NULL", //check if not_null is member of the list of column's attributes
138 if t is 148 if t is
139 { 149 {
140 //anubis(_T) then "constant_byte_array(0,0)", 150 //anubis(_T) then "constant_byte_array(0,0)",
@@ -156,10 +166,12 @@ public define String @@ -156,10 +166,12 @@ public define String
156 foreign_key(_,_,_) then "bind_DB_id_or_NULL(\":v_"+name+"\", "+type_name+"."+name+")", 166 foreign_key(_,_,_) then "bind_DB_id_or_NULL(\":v_"+name+"\", "+type_name+"."+name+")",
157 integer_field(_) then "bind_Int(\":v_"+name+"\", "+type_name+"."+name+")", 167 integer_field(_) then "bind_Int(\":v_"+name+"\", "+type_name+"."+name+")",
158 float_field then "bind_Float(\":v_"+name+"\", "+type_name+"."+name+")", 168 float_field then "bind_Float(\":v_"+name+"\", "+type_name+"."+name+")",
159 - char_field(_,_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")", 169 + char_field(_,_) then "bind_String"+or_null+"(\":v_"+name+"\", "+type_name+"."+name+")",
160 password_field(_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")", 170 password_field(_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")",
161 - text_field(_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")",  
162 - color_field then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")",  
163 - phone_field then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")",  
164 - email_field then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")", 171 + text_field(_) then "bind_String"+or_null+"(\":v_"+name+"\", "+type_name+"."+name+")",
  172 + color_field then "bind_String"+or_null+"(\":v_"+name+"\", "+type_name+"."+name+")",
  173 + phone_field then "bind_String"+or_null+"(\":v_"+name+"\", "+type_name+"."+name+")",
  174 + mobile_field then "bind_String"+or_null+"(\":v_"+name+"\", "+type_name+"."+name+")",
  175 + url_field then "bind_String"+or_null+"(\":v_"+name+"\", "+type_name+"."+name+")",
  176 + email_field then "bind_String"+or_null+"(\":v_"+name+"\", "+type_name+"."+name+")",
165 }. 177 }.
src/generation/files.anubis
@@ -41,10 +41,10 @@ define Maybe(One) @@ -41,10 +41,10 @@ define Maybe(One)
41 ) 41 )
42 = 42 =
43 since org_table is hk_table(name, short_name, old_model, display), 43 since org_table is hk_table(name, short_name, old_model, display),
44 - since old_model is hk_model(columns, show_string), 44 + since old_model is hk_model(columns, constraints, show_string),
45 since display is hk_display(list_view, list_edit), 45 since display is hk_display(list_view, list_edit),
46 46
47 - with model = hk_model([hk_column("id", p_key, []). columns], show_string ), 47 + with model = hk_model([hk_column("id", p_key, []). columns], constraints, show_string ),
48 with table = hk_table(name, short_name, model, display), 48 with table = hk_table(name, short_name, model, display),
49 println("Generating file for table ["+name+"]"); 49 println("Generating file for table ["+name+"]");
50 with file_name = dest_dir+"database/generated/"+name+".anubis", 50 with file_name = dest_dir+"database/generated/"+name+".anubis",
@@ -221,7 +221,7 @@ define One @@ -221,7 +221,7 @@ define One
221 //view interface 221 //view interface
222 //selector 222 //selector
223 get_selector_"+name+", 223 get_selector_"+name+",
224 - hk_trigger_set(var([]), var([])) //initialize the triggers list as empty 224 + hk_trigger_set(var([]), var([]), var([]), var([]), var([]), var([])) //initialize the triggers list as empty
225 )", 225 )",
226 226
227 _make_vtm(apps, t, [transmit . so_far_transmit], [view . so_far_view], [edit . so_far_edit], [controller . so_far_controllers], dest_dir) 227 _make_vtm(apps, t, [transmit . so_far_transmit], [view . so_far_view], [edit . so_far_edit], [controller . so_far_controllers], dest_dir)
@@ -256,6 +256,7 @@ define Maybe(One) @@ -256,6 +256,7 @@ define Maybe(One)
256 with ini = loadIniFile(destination_dir+"/hayamiki.ini"), 256 with ini = loadIniFile(destination_dir+"/hayamiki.ini"),
257 257
258 with db_SHA1 = readString(ini, "DB_MODEL", "SHA1", "N/A"), 258 with db_SHA1 = readString(ini, "DB_MODEL", "SHA1", "N/A"),
  259 + with version = readString(ini, "DB_MODEL", "Version", "0.0.0.0"),
259 println("Saved DB model SHA1 = "+db_SHA1); 260 println("Saved DB model SHA1 = "+db_SHA1);
260 with current_db_SHA1 = to_ascii(sha1(serialize(db))), 261 with current_db_SHA1 = to_ascii(sha1(serialize(db))),
261 println("Current DB model SHA1 = "+current_db_SHA1); 262 println("Current DB model SHA1 = "+current_db_SHA1);
@@ -272,12 +273,14 @@ define Maybe(One) @@ -272,12 +273,14 @@ define Maybe(One)
272 println("Generating VTM for Database "+name); 273 println("Generating VTM for Database "+name);
273 make_vtm(apps, destination_dir); 274 make_vtm(apps, destination_dir);
274 println("Generating create for Database "+name); 275 println("Generating create for Database "+name);
275 - if generate_create_table(apps, destination_dir) is failure then println("failure");failure else 276 + if generate_create_table(apps, destination_dir, version, current_db_SHA1) is failure then println("failure");failure else
276 println("Generating menu for Database "+name); 277 println("Generating menu for Database "+name);
277 if generate_hk_menus(apps, destination_dir) is failure then println("failure");failure else 278 if generate_hk_menus(apps, destination_dir) is failure then println("failure");failure else
278 if generate_cxm_lib_menus(apps, destination_dir) is failure then println("failure");failure else 279 if generate_cxm_lib_menus(apps, destination_dir) is failure then println("failure");failure else
279 writeString(ini, "DB_MODEL", "SHA1", current_db_SHA1); 280 writeString(ini, "DB_MODEL", "SHA1", current_db_SHA1);
  281 + writeString(ini, "DB_MODEL", "Version", version);
280 writeIniInfo(ini); 282 writeIniInfo(ini);
  283 + sleep(3000);
281 success(unique) 284 success(unique)
282 }. 285 }.
283 286
src/generation/fn_delete.anubis
@@ -21,7 +21,7 @@ public define Maybe(One) @@ -21,7 +21,7 @@ public define Maybe(One)
21 HK_Table table 21 HK_Table table
22 )= 22 )=
23 since table is hk_table(name, short_name, model, _), 23 since table is hk_table(name, short_name, model, _),
24 - since model is hk_model( columns, _), 24 + since model is hk_model( columns, constraints, _),
25 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 25 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
26 26
27 //generate the type of the table that contain all components 27 //generate the type of the table that contain all components
src/generation/html.anubis
@@ -108,6 +108,8 @@ public define String @@ -108,6 +108,8 @@ public define String
108 text_field(attrs) then to_HTML_cell_text(column, data_name, general_type_name), 108 text_field(attrs) then to_HTML_cell_text(column, data_name, general_type_name),
109 color_field then to_HTML_cell_text(column, data_name, general_type_name), 109 color_field then to_HTML_cell_text(column, data_name, general_type_name),
110 phone_field then to_HTML_cell_text(column, data_name, general_type_name), 110 phone_field then to_HTML_cell_text(column, data_name, general_type_name),
  111 + mobile_field then to_HTML_cell_text(column, data_name, general_type_name),
  112 + url_field then to_HTML_cell_text(column, data_name, general_type_name),
111 email_field then to_HTML_cell_text(column, data_name, general_type_name) 113 email_field then to_HTML_cell_text(column, data_name, general_type_name)
112 } 114 }
113 }. 115 }.
@@ -121,7 +123,7 @@ public define String @@ -121,7 +123,7 @@ public define String
121 HK_Viewer list_view //list view to generate 123 HK_Viewer list_view //list view to generate
122 )= 124 )=
123 since table is hk_table(table_name, short, model, _), //get name and model of the table 125 since table is hk_table(table_name, short, model, _), //get name and model of the table
124 - since model is hk_model( columns, _), //get all columns of table 126 + since model is hk_model( columns, _, _), //get all columns of table
125 // since display is db_display(views, _), // 127 // since display is db_display(views, _), //
126 with current_list_column = if list_view is 128 with current_list_column = if list_view is
127 { 129 {
src/generation/icons.anubis
@@ -36,6 +36,8 @@ public define String @@ -36,6 +36,8 @@ public define String
36 text_field(_) then icn16_question, 36 text_field(_) then icn16_question,
37 color_field then icn16_question, 37 color_field then icn16_question,
38 phone_field then icn16_phone, 38 phone_field then icn16_phone,
  39 + mobile_field then icn16_question,
  40 + url_field then icn16_question,
39 email_field then icn16_email 41 email_field then icn16_email
40 }. 42 }.
41 43
src/generation/json.anubis
@@ -36,6 +36,8 @@ public define String @@ -36,6 +36,8 @@ public define String
36 text_field(_) then "to_JSON_String("+current_type_name+"."+name+")", 36 text_field(_) then "to_JSON_String("+current_type_name+"."+name+")",
37 color_field then "to_JSON_String("+current_type_name+"."+name+")", 37 color_field then "to_JSON_String("+current_type_name+"."+name+")",
38 phone_field then "to_JSON_String("+current_type_name+"."+name+")", 38 phone_field then "to_JSON_String("+current_type_name+"."+name+")",
  39 + mobile_field then "to_JSON_String("+current_type_name+"."+name+")",
  40 + url_field then "to_JSON_String("+current_type_name+"."+name+")",
39 email_field then "to_JSON_String("+current_type_name+"."+name+")", 41 email_field then "to_JSON_String("+current_type_name+"."+name+")",
40 } 42 }
41 . 43 .
@@ -68,6 +70,8 @@ public define String @@ -68,6 +70,8 @@ public define String
68 text_field(_) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", 70 text_field(_) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))",
69 color_field then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", 71 color_field then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))",
70 phone_field then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", 72 phone_field then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))",
  73 + mobile_field then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))",
  74 + url_field then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))",
71 email_field then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", 75 email_field then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))",
72 } 76 }
73 . 77 .
@@ -100,6 +104,8 @@ public define String @@ -100,6 +104,8 @@ public define String
100 text_field(_) then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", 104 text_field(_) then "json_member(\""+name+"\", json_string(text"+cursor_index+"))",
101 color_field then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", 105 color_field then "json_member(\""+name+"\", json_string(text"+cursor_index+"))",
102 phone_field then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", 106 phone_field then "json_member(\""+name+"\", json_string(text"+cursor_index+"))",
  107 + mobile_field then "json_member(\""+name+"\", json_string(text"+cursor_index+"))",
  108 + url_field then "json_member(\""+name+"\", json_string(text"+cursor_index+"))",
103 email_field then "json_member(\""+name+"\", json_string(text"+cursor_index+"))" 109 email_field then "json_member(\""+name+"\", json_string(text"+cursor_index+"))"
104 } 110 }
105 . 111 .
src/generation/types.anubis
@@ -38,7 +38,7 @@ public define Maybe(One) @@ -38,7 +38,7 @@ public define Maybe(One)
38 Bool use_densaku 38 Bool use_densaku
39 )= 39 )=
40 since table is hk_table(name, short_name, model, display), 40 since table is hk_table(name, short_name, model, display),
41 - since model is hk_model(columns, show_string), 41 + since model is hk_model(columns, constraints, show_string),
42 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 42 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
43 43
44 //if we use densaku for generating the type, we insert the read of that type after densaku generation 44 //if we use densaku for generating the type, we insert the read of that type after densaku generation
@@ -83,7 +83,7 @@ public define Maybe(One) @@ -83,7 +83,7 @@ public define Maybe(One)
83 HK_Table table 83 HK_Table table
84 )= 84 )=
85 since table is hk_table(name, short_name, model, _), 85 since table is hk_table(name, short_name, model, _),
86 - since model is hk_model(columns, show_string), 86 + since model is hk_model(columns, constraints, show_string),
87 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 87 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
88 88
89 //generate the type of the table that contain all components 89 //generate the type of the table that contain all components
@@ -104,7 +104,7 @@ public define Maybe(One) @@ -104,7 +104,7 @@ public define Maybe(One)
104 HK_Table table 104 HK_Table table
105 )= 105 )=
106 since table is hk_table(name, short_name, model, _), 106 since table is hk_table(name, short_name, model, _),
107 - since model is hk_model(columns, show_string), 107 + since model is hk_model(columns, constraints, show_string),
108 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 108 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
109 109
110 //generate the type of the table that contain all components 110 //generate the type of the table that contain all components
@@ -127,7 +127,7 @@ public define Maybe(One) @@ -127,7 +127,7 @@ public define Maybe(One)
127 HK_Table table 127 HK_Table table
128 )= 128 )=
129 since table is hk_table(name, short_name, model, _), 129 since table is hk_table(name, short_name, model, _),
130 - since model is hk_model(columns, show_string), 130 + since model is hk_model(columns, constraints, show_string),
131 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 131 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
132 132
133 //generate the type of the table that contain all components 133 //generate the type of the table that contain all components
@@ -205,7 +205,7 @@ public define Maybe(One) @@ -205,7 +205,7 @@ public define Maybe(One)
205 HK_Table table 205 HK_Table table
206 )= 206 )=
207 since table is hk_table(name, short_name, model, _), 207 since table is hk_table(name, short_name, model, _),
208 - since model is hk_model(columns, show_string), 208 + since model is hk_model(columns, constraints, show_string),
209 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 209 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
210 210
211 //generate the type of the table that contain all components 211 //generate the type of the table that contain all components
@@ -259,7 +259,7 @@ public define Maybe(One) @@ -259,7 +259,7 @@ public define Maybe(One)
259 HK_Table table 259 HK_Table table
260 )= 260 )=
261 since table is hk_table(name, short_name, model, _), 261 since table is hk_table(name, short_name, model, _),
262 - since model is hk_model(columns, show_string), 262 + since model is hk_model(columns, constraints, show_string),
263 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 263 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
264 264
265 //generate the type of the table that contain all components 265 //generate the type of the table that contain all components
@@ -290,7 +290,7 @@ public define Maybe(One) @@ -290,7 +290,7 @@ public define Maybe(One)
290 HK_Table table 290 HK_Table table
291 )= 291 )=
292 since table is hk_table(name, short_name, model, _), 292 since table is hk_table(name, short_name, model, _),
293 - since model is hk_model( columns, _), 293 + since model is hk_model( columns, constraints, _),
294 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 294 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
295 295
296 //generate the type of the table that contain all components 296 //generate the type of the table that contain all components
@@ -399,7 +399,7 @@ public define Maybe(One) @@ -399,7 +399,7 @@ public define Maybe(One)
399 HK_Table table 399 HK_Table table
400 )= 400 )=
401 since table is hk_table(name, short_name, model, _), 401 since table is hk_table(name, short_name, model, _),
402 - since model is hk_model( columns, show_string), 402 + since model is hk_model( columns, constraints, show_string),
403 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 403 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
404 404
405 //generate the type of the table that contain all components 405 //generate the type of the table that contain all components
@@ -435,7 +435,7 @@ public define Maybe(One) @@ -435,7 +435,7 @@ public define Maybe(One)
435 HK_Table table 435 HK_Table table
436 )= 436 )=
437 since table is hk_table(name, short_name, model, _), 437 since table is hk_table(name, short_name, model, _),
438 - since model is hk_model( columns, show_string), 438 + since model is hk_model( columns, constraints, show_string),
439 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 439 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
440 440
441 //generate the type of the table that contain all components 441 //generate the type of the table that contain all components
src/generation/vt_edit.anubis
@@ -29,7 +29,7 @@ public define Maybe(One) @@ -29,7 +29,7 @@ public define Maybe(One)
29 HK_Editor edit_view //edit view to generate 29 HK_Editor edit_view //edit view to generate
30 )= 30 )=
31 since table is hk_table(table_name, short_name, model, display), 31 since table is hk_table(table_name, short_name, model, display),
32 - since model is hk_model( columns, _), 32 + since model is hk_model( columns, constraints, _),
33 //since display is db_display(list_view, list_edit), 33 //since display is db_display(list_view, list_edit),
34 34
35 with type_name = to_upper(table_name, 1), //make the first character to upper case and be an Anubis Type. 35 with type_name = to_upper(table_name, 1), //make the first character to upper case and be an Anubis Type.
@@ -170,7 +170,7 @@ public define Maybe(One) @@ -170,7 +170,7 @@ public define Maybe(One)
170 HK_Table table 170 HK_Table table
171 )= 171 )=
172 since table is hk_table(name, short_name, model, display), 172 since table is hk_table(name, short_name, model, display),
173 - since model is hk_model( columns, _), 173 + since model is hk_model( columns, constraints, _),
174 since display is hk_display(_, list_edit), 174 since display is hk_display(_, list_edit),
175 175
176 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 176 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
src/generation/vt_view.anubis
@@ -79,6 +79,8 @@ define String @@ -79,6 +79,8 @@ define String
79 text_field(txt_attr) then "text_area(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", 79 text_field(txt_attr) then "text_area(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")",
80 color_field then "color(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", 80 color_field then "color(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")",
81 phone_field then "phone(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", 81 phone_field then "phone(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")",
  82 + mobile_field then "mobile_phone(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")",
  83 + url_field then "url(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")",
82 email_field then "email(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")" 84 email_field then "email(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")"
83 85
84 }. 86 }.
@@ -113,7 +115,7 @@ public define Maybe(One) @@ -113,7 +115,7 @@ public define Maybe(One)
113 HK_Viewer list_view //list view to generate 115 HK_Viewer list_view //list view to generate
114 )= 116 )=
115 since table is hk_table(table_name, short_name, model, display), 117 since table is hk_table(table_name, short_name, model, display),
116 - since model is hk_model( columns, _), 118 + since model is hk_model( columns, constraints, _),
117 //since display is db_display(list_view, list_edit), 119 //since display is db_display(list_view, list_edit),
118 120
119 with type_name = to_upper(table_name, 1), //make the first character to upper case and be an Anubis Type. 121 with type_name = to_upper(table_name, 1), //make the first character to upper case and be an Anubis Type.
@@ -351,7 +353,7 @@ public define Maybe(One) @@ -351,7 +353,7 @@ public define Maybe(One)
351 HK_Table table 353 HK_Table table
352 )= 354 )=
353 since table is hk_table(name, short_name, model, display), 355 since table is hk_table(name, short_name, model, display),
354 - since model is hk_model( columns, _), 356 + since model is hk_model( columns, constraints, _),
355 since display is hk_display(list_view, list_edit), 357 since display is hk_display(list_view, list_edit),
356 358
357 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 359 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
src/generation/web_args.anubis
@@ -34,6 +34,8 @@ public define String @@ -34,6 +34,8 @@ public define String
34 text_field(_) then "get_String(lwa, __prefix__+\""+name+"\")", 34 text_field(_) then "get_String(lwa, __prefix__+\""+name+"\")",
35 color_field then "get_String(lwa, __prefix__+\""+name+"\")", 35 color_field then "get_String(lwa, __prefix__+\""+name+"\")",
36 phone_field then "get_String(lwa, __prefix__+\""+name+"\")", 36 phone_field then "get_String(lwa, __prefix__+\""+name+"\")",
  37 + mobile_field then "get_String(lwa, __prefix__+\""+name+"\")",
  38 + url_field then "get_String(lwa, __prefix__+\""+name+"\")",
37 email_field then "get_String(lwa, __prefix__+\""+name+"\")" 39 email_field then "get_String(lwa, __prefix__+\""+name+"\")"
38 }. 40 }.
39 41
@@ -87,6 +89,8 @@ public define String @@ -87,6 +89,8 @@ public define String
87 text_field(_) then "get_String(lwa, __prefix__+\""+name+"\", "+to_Anubis_default(col_type)+"),", 89 text_field(_) then "get_String(lwa, __prefix__+\""+name+"\", "+to_Anubis_default(col_type)+"),",
88 color_field then "get_String(lwa, __prefix__+\""+name+"\", "+to_Anubis_default(col_type)+"),", 90 color_field then "get_String(lwa, __prefix__+\""+name+"\", "+to_Anubis_default(col_type)+"),",
89 phone_field then "get_String(lwa, __prefix__+\""+name+"\", "+to_Anubis_default(col_type)+"),", 91 phone_field then "get_String(lwa, __prefix__+\""+name+"\", "+to_Anubis_default(col_type)+"),",
  92 + mobile_field then "get_String(lwa, __prefix__+\""+name+"\", "+to_Anubis_default(col_type)+"),",
  93 + url_field then "get_String(lwa, __prefix__+\""+name+"\", "+to_Anubis_default(col_type)+"),",
90 email_field then "get_String(lwa, __prefix__+\""+name+"\", "+to_Anubis_default(col_type)+")," 94 email_field then "get_String(lwa, __prefix__+\""+name+"\", "+to_Anubis_default(col_type)+"),"
91 }. 95 }.
92 96
@@ -120,7 +124,7 @@ public define Maybe(One) @@ -120,7 +124,7 @@ public define Maybe(One)
120 HK_Table table 124 HK_Table table
121 )= 125 )=
122 since table is hk_table(name, short_name, model, _), 126 since table is hk_table(name, short_name, model, _),
123 - since model is hk_model(columns, _), 127 + since model is hk_model(columns, constraint, _),
124 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 128 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
125 since _generate_extract_web_arg_to_type(columns, [], 0) is ((List(String))list_of_web_arg, (Int) nb_closure), 129 since _generate_extract_web_arg_to_type(columns, [], 0) is ((List(String))list_of_web_arg, (Int) nb_closure),
126 //generate the type of the table that contain all components 130 //generate the type of the table that contain all components
@@ -215,6 +219,10 @@ public define String @@ -215,6 +219,10 @@ public define String
215 "if get_String(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_String(\":v_"+name+"\", "+name+"))] }" 219 "if get_String(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_String(\":v_"+name+"\", "+name+"))] }"
216 phone_field then 220 phone_field then
217 "if get_String(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_String(\":v_"+name+"\", "+name+"))] }" 221 "if get_String(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_String(\":v_"+name+"\", "+name+"))] }"
  222 + mobile_field then
  223 + "if get_String(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_String(\":v_"+name+"\", "+name+"))] }"
  224 + url_field then
  225 + "if get_String(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_String(\":v_"+name+"\", "+name+"))] }"
218 email_field then 226 email_field then
219 "if get_String(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_String(\":v_"+name+"\", "+name+"))] }" 227 "if get_String(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_String(\":v_"+name+"\", "+name+"))] }"
220 }. 228 }.
@@ -245,7 +253,7 @@ public define Maybe(One) @@ -245,7 +253,7 @@ public define Maybe(One)
245 HK_Table table 253 HK_Table table
246 )= 254 )=
247 since table is hk_table(name, short_name, model, _), 255 since table is hk_table(name, short_name, model, _),
248 - since model is hk_model(columns, _), 256 + since model is hk_model(columns, constraints, _),
249 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. 257 with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
250 258
251 //generate the type of the table that contain all components 259 //generate the type of the table that contain all components