Commit 8b28092790300b17a97b873bcc4f06bd4048fd16
1 parent
63473dfb
add the generation of the selector for foreign key
fix the column name which can be reserved keyword like 'index' by enclose it with double quote -ie-> "index" will protect the column name to not be confused with the index keyword add some table to generate
Showing
5 changed files
with
586 additions
and
93 deletions
Show diff stats
calexium_lib @ 204b0087037
src/generation/files.anubis
| @@ -18,11 +18,13 @@ read generation/types.anubis | @@ -18,11 +18,13 @@ read generation/types.anubis | ||
| 18 | define Maybe(One) | 18 | define Maybe(One) |
| 19 | generate_table | 19 | generate_table |
| 20 | ( | 20 | ( |
| 21 | - DB_Table table | 21 | + DB_Table org_table |
| 22 | ) | 22 | ) |
| 23 | = | 23 | = |
| 24 | - since table is db_table(name, model, display), | ||
| 25 | - since model is db_model(columns, show_string), | 24 | + since org_table is db_table(name, old_model, display), |
| 25 | + since old_model is db_model(columns, show_string), | ||
| 26 | + with model = db_model([db_column("id", p_key, []). columns], show_string ), | ||
| 27 | + with table = db_table(name, model, display), | ||
| 26 | println("Generating file for table ["+name+"]"); | 28 | println("Generating file for table ["+name+"]"); |
| 27 | with file_name = name+".anubis", | 29 | with file_name = name+".anubis", |
| 28 | if file(file_name, new) is | 30 | if file(file_name, new) is |
| @@ -30,18 +32,19 @@ define Maybe(One) | @@ -30,18 +32,19 @@ define Maybe(One) | ||
| 30 | failure then println("can't create file "+file_name);failure, | 32 | failure then println("can't create file "+file_name);failure, |
| 31 | success(fd) then | 33 | success(fd) then |
| 32 | with strm = make_stream(fd), | 34 | with strm = make_stream(fd), |
| 33 | - if generate_header(strm, columns) is { failure then failure, success(_) then | ||
| 34 | - if generate_type(strm, table) is { failure then failure, success(_) then | ||
| 35 | - if generate_get_default(strm, table) is { failure then failure, success(_) then | ||
| 36 | - if generate_extract_web_arg(strm, table) is { failure then failure, success(_) then | ||
| 37 | - if generate_extract_db_cursor(strm, table) is { failure then failure, success(_) then | ||
| 38 | - if generate_get_all(strm, table) is { failure then failure, success(_) then | ||
| 39 | - if generate_get_one(strm, table) is { failure then failure, success(_) then | ||
| 40 | - if generate_update(strm, table) is { failure then failure, success(_) then | ||
| 41 | - if generate_show_string(strm, table) is { failure then failure, success(_) then | ||
| 42 | - if generate_VT_view(strm, table) is { failure then failure, success(_) then | ||
| 43 | - if generate_VT_edit(strm, table) is { failure then failure, success(_) then | ||
| 44 | - success(unique)}}}}}}}}}}} | 35 | + if generate_header(strm, columns) is { failure then failure, success(_) then |
| 36 | + if generate_type(strm, table) is { failure then failure, success(_) then | ||
| 37 | + if generate_get_default(strm, table) is { failure then failure, success(_) then | ||
| 38 | + if generate_extract_web_arg(strm, table) is { failure then failure, success(_) then | ||
| 39 | + if generate_extract_db_cursor(strm, table) is { failure then failure, success(_) then | ||
| 40 | + if generate_get_all(strm, table) is { failure then failure, success(_) then | ||
| 41 | + if generate_get_one(strm, table) is { failure then failure, success(_) then | ||
| 42 | + if generate_update(strm, table) is { failure then failure, success(_) then | ||
| 43 | + if generate_show_string(strm, table) is { failure then failure, success(_) then | ||
| 44 | + if generate_selector(strm, table) is { failure then failure, success(_) then | ||
| 45 | + if generate_VT_view(strm, table) is { failure then failure, success(_) then | ||
| 46 | + if generate_VT_edit(strm, table) is { failure then failure, success(_) then | ||
| 47 | + success(unique)}}}}}}}}}}}} | ||
| 45 | }. | 48 | }. |
| 46 | 49 | ||
| 47 | define One | 50 | define One |
src/generation/header.anubis
| @@ -61,6 +61,7 @@ read data_base/db_tools.anubis | @@ -61,6 +61,7 @@ read data_base/db_tools.anubis | ||
| 61 | read calexium_lib/database/db_utils.anubis | 61 | read calexium_lib/database/db_utils.anubis |
| 62 | read calexium_lib/database/db_types.anubis | 62 | read calexium_lib/database/db_types.anubis |
| 63 | read calexium_lib/database/vtm/view_table_types.anubis | 63 | read calexium_lib/database/vtm/view_table_types.anubis |
| 64 | +read calexium_lib/database/model/db_model.anubis | ||
| 64 | 65 | ||
| 65 | read system/logger.anubis | 66 | read system/logger.anubis |
| 66 | read system/datetime.anubis | 67 | read system/datetime.anubis |
src/generation/types.anubis
| @@ -144,7 +144,7 @@ public define Maybe(One) | @@ -144,7 +144,7 @@ public define Maybe(One) | ||
| 144 | //generate the type of the table that contain all components | 144 | //generate the type of the table that contain all components |
| 145 | if write_string(stream, | 145 | if write_string(stream, |
| 146 | "\n\n"+ | 146 | "\n\n"+ |
| 147 | - "define Maybe("+type_name+")\n"+ | 147 | + "public define Maybe("+type_name+")\n"+ |
| 148 | " extract_"+name+"\n"+ | 148 | " extract_"+name+"\n"+ |
| 149 | " (\n"+ | 149 | " (\n"+ |
| 150 | " One -> SQLite3Row table_cursor\n"+ | 150 | " One -> SQLite3Row table_cursor\n"+ |
| @@ -175,7 +175,7 @@ public define Maybe(One) | @@ -175,7 +175,7 @@ public define Maybe(One) | ||
| 175 | //generate the type of the table that contain all components | 175 | //generate the type of the table that contain all components |
| 176 | if write_string(stream, | 176 | if write_string(stream, |
| 177 | "\n\n"+ | 177 | "\n\n"+ |
| 178 | - "define List("+type_name+")\n"+ | 178 | + "public define List("+type_name+")\n"+ |
| 179 | " _get_all_"+name+"\n"+ | 179 | " _get_all_"+name+"\n"+ |
| 180 | " (\n"+ | 180 | " (\n"+ |
| 181 | " One -> SQLite3Row table_cursor,\n"+ | 181 | " One -> SQLite3Row table_cursor,\n"+ |
| @@ -193,7 +193,7 @@ public define Maybe(One) | @@ -193,7 +193,7 @@ public define Maybe(One) | ||
| 193 | " (\n"+ | 193 | " (\n"+ |
| 194 | " SQLite3DataBase db,\n"+ | 194 | " SQLite3DataBase db,\n"+ |
| 195 | " )=\n"+ | 195 | " )=\n"+ |
| 196 | - " if sql_query_timeout(db, \"SELECT "+join(", ", components(columns, []))+" FROM "+name+";\", [], \"get_all_"+name+"\") is\n"+ | 196 | + " if sql_query_timeout(db, \"SELECT "+join(", ", enclose("\\\"",components(columns, [])) )+" FROM "+name+";\", [], \"get_all_"+name+"\") is\n"+ |
| 197 | " {\n"+ | 197 | " {\n"+ |
| 198 | " error(_) then [],\n"+ | 198 | " error(_) then [],\n"+ |
| 199 | " ok(_, cursor, _) then _get_all_"+name+"(cursor, [])\n"+ | 199 | " ok(_, cursor, _) then _get_all_"+name+"(cursor, [])\n"+ |
| @@ -225,7 +225,7 @@ public define Maybe(One) | @@ -225,7 +225,7 @@ public define Maybe(One) | ||
| 225 | " SQLite3DataBase db,\n"+ | 225 | " SQLite3DataBase db,\n"+ |
| 226 | " String idx\n"+ | 226 | " String idx\n"+ |
| 227 | " )=\n"+ | 227 | " )=\n"+ |
| 228 | - " if sql_query_timeout(db, \"SELECT "+join(", ", components(columns, []))+" FROM "+name+" WHERE id=\"+idx+\";\", [], \"get_"+name+"\") is\n"+ | 228 | + " if sql_query_timeout(db, \"SELECT "+join(", ", enclose("\\\"",components(columns, [])))+" FROM "+name+" WHERE id=\"+idx+\";\", [], \"get_"+name+"\") is\n"+ |
| 229 | " {\n"+ | 229 | " {\n"+ |
| 230 | " error(_) then failure,\n"+ | 230 | " error(_) then failure,\n"+ |
| 231 | " ok(_, cursor, _) then extract_"+name+"(cursor)\n"+ | 231 | " ok(_, cursor, _) then extract_"+name+"(cursor)\n"+ |
| @@ -331,6 +331,48 @@ public define Maybe(One) | @@ -331,6 +331,48 @@ public define Maybe(One) | ||
| 331 | failure then println("can't write generate_update "+type_name); failure, | 331 | failure then println("can't write generate_update "+type_name); failure, |
| 332 | success(_) then success(unique) | 332 | success(_) then success(unique) |
| 333 | }. | 333 | }. |
| 334 | + | ||
| 335 | +public define Maybe(One) | ||
| 336 | + generate_selector | ||
| 337 | + ( | ||
| 338 | + Stream stream, | ||
| 339 | + DB_Table table | ||
| 340 | + )= | ||
| 341 | + since table is db_table(name, model, _), | ||
| 342 | + since model is db_model( columns, show_string), | ||
| 343 | + with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. | ||
| 344 | + | ||
| 345 | + //generate the type of the table that contain all components | ||
| 346 | + if write_string(stream, | ||
| 347 | + "\n\n"+ | ||
| 348 | + "define List((List(CoreAttrs), WebArgValue, String))\n"+ | ||
| 349 | + " _get_selector_"+name+"\n"+ | ||
| 350 | + " (\n"+ | ||
| 351 | + " SQLite3DataBase db,\n"+ | ||
| 352 | + " List("+type_name+") list,\n"+ | ||
| 353 | + " List((List(CoreAttrs), WebArgValue, String)) so_far\n"+ | ||
| 354 | + " )=\n"+ | ||
| 355 | + " if list is\n"+ | ||
| 356 | + " {\n"+ | ||
| 357 | + " [] then reverse(so_far),\n"+ | ||
| 358 | + " [ h . t ] then \n"+ | ||
| 359 | + " if h.id is \n"+ | ||
| 360 | + " {\n"+ | ||
| 361 | + " none then [],\n"+ | ||
| 362 | + " db_id(id) then _get_selector_"+name+"(db, t, [([], wav(to_String(id)), get_"+name+"_show_string(db, id)) . so_far])\n"+ | ||
| 363 | + " }\n"+ | ||
| 364 | + " }.\n\n"+ | ||
| 365 | + "public define List((List(CoreAttrs), WebArgValue, String))\n"+ | ||
| 366 | + " get_selector_"+name+"\n"+ | ||
| 367 | + " (\n"+ | ||
| 368 | + " SQLite3DataBase db,\n"+ | ||
| 369 | + " )=\n"+ | ||
| 370 | + " _get_selector_"+name+"(db, get_all_"+name+"(db), [])." | ||
| 371 | + ) is //end of the function | ||
| 372 | + { | ||
| 373 | + failure then println("can't write generate_show_string "+type_name); failure, | ||
| 374 | + success(_) then success(unique) | ||
| 375 | + }. | ||
| 334 | 376 | ||
| 335 | public define Maybe(One) | 377 | public define Maybe(One) |
| 336 | generate_VT_view | 378 | generate_VT_view |
| @@ -338,8 +380,8 @@ public define Maybe(One) | @@ -338,8 +380,8 @@ public define Maybe(One) | ||
| 338 | Stream stream, | 380 | Stream stream, |
| 339 | DB_Table table | 381 | DB_Table table |
| 340 | )= | 382 | )= |
| 341 | - since table is db_table(name, model, display), | ||
| 342 | - since model is db_model( columns, _), | 383 | + since table is db_table(name, model, display), |
| 384 | + since model is db_model( columns, _), | ||
| 343 | since display is db_display(list_view, list_edit), | 385 | since display is db_display(list_view, list_edit), |
| 344 | 386 | ||
| 345 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. | 387 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. |
| @@ -366,7 +408,7 @@ public define Maybe(One) | @@ -366,7 +408,7 @@ public define Maybe(One) | ||
| 366 | " [ h . t ] then\n"+ | 408 | " [ h . t ] then\n"+ |
| 367 | " with entry = vt_view_row([\n"+ | 409 | " with entry = vt_view_row([\n"+ |
| 368 | // view row | 410 | // view row |
| 369 | - make_list_view_row(model, list_view, "h", " ")+"\n"+ | 411 | + make_list_view_row(table, "h", " ")+"\n"+ |
| 370 | " ]),\n"+ | 412 | " ]),\n"+ |
| 371 | " _get_viewable_"+name+"(db, t, [entry . so_far])\n"+ | 413 | " _get_viewable_"+name+"(db, t, [entry . so_far])\n"+ |
| 372 | " }.\n\n"+ | 414 | " }.\n\n"+ |
src/model.3.0.0.anubis
| @@ -6,22 +6,22 @@ public define DB_Table mf_serial_table = | @@ -6,22 +6,22 @@ public define DB_Table mf_serial_table = | ||
| 6 | db_table("mf_serial", | 6 | db_table("mf_serial", |
| 7 | db_model( | 7 | db_model( |
| 8 | [ | 8 | [ |
| 9 | - db_column("id", p_key, []), | 9 | + |
| 10 | db_column("serial", char_field(30), []), | 10 | db_column("serial", char_field(30), []), |
| 11 | db_column("mac", char_field(30), []), | 11 | db_column("mac", char_field(30), []), |
| 12 | db_column("app_id", char_field(50), []), | 12 | db_column("app_id", char_field(50), []), |
| 13 | - db_column("enabled",boolean_field, []), | ||
| 14 | - db_column("free_domain",boolean_field, []), | ||
| 15 | - db_column("max_domains",integer_field, []), | ||
| 16 | - db_column("is_demo",boolean_field, []), | ||
| 17 | - db_column("is_test",boolean_field, []), | 13 | + db_column("enabled",boolean_field, [], help_text("Is enabled?")), |
| 14 | + db_column("free_domain",boolean_field, [], help_text("Free domain available?")), | ||
| 15 | + db_column("max_domains",integer_field, [], help_text("Maximum number of domains")), | ||
| 16 | + db_column("is_demo",boolean_field, [], help_text("Is demo?")), | ||
| 17 | + db_column("is_test", boolean_field, [], help_text("Is test?")), | ||
| 18 | db_column("date_created", datetime_field(auto_now_add), []), | 18 | db_column("date_created", datetime_field(auto_now_add), []), |
| 19 | db_column("last_updated", datetime_field(none), []), | 19 | db_column("last_updated", datetime_field(none), []), |
| 20 | - db_column("last_ping", datetime_field(none), []), | ||
| 21 | - db_column("current_ip", char_field(20), []), | ||
| 22 | - db_column("mf_version", char_field(20), []), | ||
| 23 | - db_column("vm_version", char_field(20), []), | ||
| 24 | - db_column("os_version", char_field(20), []), | 20 | + db_column("last_ping", datetime_field(none), []), |
| 21 | + db_column("current_ip", char_field(20), []), | ||
| 22 | + db_column("mf_version", char_field(20), [], help_text("MF version")), | ||
| 23 | + db_column("vm_version", char_field(20), [], help_text_TAG("ANUBIS_VM_VER")), | ||
| 24 | + db_column("os_version", char_field(20), [], help_text("OS version")), | ||
| 25 | db_column("ipkg_list", text_field, []), | 25 | db_column("ipkg_list", text_field, []), |
| 26 | db_column("ifconfig", text_field, []), | 26 | db_column("ifconfig", text_field, []), |
| 27 | db_column("dmesg", text_field, []), | 27 | db_column("dmesg", text_field, []), |
| @@ -32,7 +32,7 @@ public define DB_Table mf_serial_table = | @@ -32,7 +32,7 @@ public define DB_Table mf_serial_table = | ||
| 32 | db_column("isp_smtp", text_field, []), | 32 | db_column("isp_smtp", text_field, []), |
| 33 | db_column("description", text_field, []), | 33 | db_column("description", text_field, []), |
| 34 | db_column("comments", text_field, []), | 34 | db_column("comments", text_field, []), |
| 35 | - db_column("alert_received",boolean_field, []), | 35 | + db_column("alert_received",boolean_field, [], help_text("Alert received?")), |
| 36 | db_column("alert_date", datetime_field(none), []), | 36 | db_column("alert_date", datetime_field(none), []), |
| 37 | db_column("alert_msg", text_field, []), | 37 | db_column("alert_msg", text_field, []), |
| 38 | db_column("alert_mf_version", char_field(20), []), | 38 | db_column("alert_mf_version", char_field(20), []), |
| @@ -41,7 +41,7 @@ public define DB_Table mf_serial_table = | @@ -41,7 +41,7 @@ public define DB_Table mf_serial_table = | ||
| 41 | ), | 41 | ), |
| 42 | db_display( | 42 | db_display( |
| 43 | //list_view | 43 | //list_view |
| 44 | - ["id", "serial", "mf_version", "mac", "app_id", "is_demo", "is_test", "last_updated", "last_ping", "mf_version", ], | 44 | + [ "serial", "mf_version", "mac", "app_id", "is_demo", "is_test", "last_updated", "last_ping", "mf_version", ], |
| 45 | //list edit | 45 | //list edit |
| 46 | ["serial", "mac", "app_id", "enabled", "free_domain", "max_domains", "is_demo", "is_test", "date_created", "last_updated", "last_ping", "current_ip", "mf_version", | 46 | ["serial", "mac", "app_id", "enabled", "free_domain", "max_domains", "is_demo", "is_test", "date_created", "last_updated", "last_ping", "current_ip", "mf_version", |
| 47 | "os_version", "ipkg_list", "ifconfig", "dmesg", "memory", "vm_memory", "status", "disks", "isp_smtp", "description", "comments", "alert_received", "alert_date", | 47 | "os_version", "ipkg_list", "ifconfig", "dmesg", "memory", "vm_memory", "status", "disks", "isp_smtp", "description", "comments", "alert_received", "alert_date", |
| @@ -53,7 +53,7 @@ public define DB_Table settings_table = | @@ -53,7 +53,7 @@ public define DB_Table settings_table = | ||
| 53 | db_table("settings", | 53 | db_table("settings", |
| 54 | db_model( | 54 | db_model( |
| 55 | [ | 55 | [ |
| 56 | - db_column("id", p_key, []), | 56 | + |
| 57 | db_column("var_name", char_field(20), []), | 57 | db_column("var_name", char_field(20), []), |
| 58 | db_column("var_value", char_field(20), []), | 58 | db_column("var_value", char_field(20), []), |
| 59 | ], | 59 | ], |
| @@ -61,7 +61,7 @@ public define DB_Table settings_table = | @@ -61,7 +61,7 @@ public define DB_Table settings_table = | ||
| 61 | ), | 61 | ), |
| 62 | db_display( | 62 | db_display( |
| 63 | //list_view | 63 | //list_view |
| 64 | - ["id", "var_name", "var_value"], | 64 | + [ "var_name", "var_value"], |
| 65 | //list edit | 65 | //list edit |
| 66 | ["var_name", "var_value"] | 66 | ["var_name", "var_value"] |
| 67 | ) | 67 | ) |
| @@ -71,22 +71,22 @@ public define DB_Table django_admin_log_table = | @@ -71,22 +71,22 @@ public define DB_Table django_admin_log_table = | ||
| 71 | db_table("django_admin_log", | 71 | db_table("django_admin_log", |
| 72 | db_model( | 72 | db_model( |
| 73 | [ | 73 | [ |
| 74 | - db_column("id", p_key, []), | ||
| 75 | - db_column("action_time", datetime_field(auto_now_add), []), | 74 | + |
| 75 | + db_column("action_time", datetime_field(auto_now_add), []), | ||
| 76 | // db_column("user_id", foreign_key("auth_user"), [indexed]), | 76 | // db_column("user_id", foreign_key("auth_user"), [indexed]), |
| 77 | // db_column("content_type_id", foreign_key("django_content_type"), [indexed]), | 77 | // db_column("content_type_id", foreign_key("django_content_type"), [indexed]), |
| 78 | - db_column("user_id", integer_field, []), | ||
| 79 | - db_column("content_type_id", integer_field, []), | ||
| 80 | - db_column("object_id", text_field, []), | ||
| 81 | - db_column("object_repr", char_field(200), []), | ||
| 82 | - db_column("action_flag", integer_field, []), | ||
| 83 | - db_column("change_message", text_field, []), | 78 | + db_column("user_id", integer_field, []), |
| 79 | + db_column("content_type_id", integer_field, []), | ||
| 80 | + db_column("object_id", text_field, []), | ||
| 81 | + db_column("object_repr", char_field(200), []), | ||
| 82 | + db_column("action_flag", integer_field, []), | ||
| 83 | + db_column("change_message", text_field, []), | ||
| 84 | ], | 84 | ], |
| 85 | "obj.object_repr" | 85 | "obj.object_repr" |
| 86 | ), | 86 | ), |
| 87 | db_display( | 87 | db_display( |
| 88 | //list_view | 88 | //list_view |
| 89 | - ["id", "action_time", "user_id", "content_type_id", "object_id", "object_repr", "action_flag", "change_message" ], | 89 | + [ "action_time", "user_id", "content_type_id", "object_id", "object_repr", "action_flag", "change_message" ], |
| 90 | //list edit | 90 | //list edit |
| 91 | ["action_time", "user_id", "content_type_id", "object_id", "object_repr", "action_flag", "change_message"] | 91 | ["action_time", "user_id", "content_type_id", "object_id", "object_repr", "action_flag", "change_message"] |
| 92 | ) | 92 | ) |
| @@ -96,7 +96,7 @@ public define DB_Table production_macaddress_table = | @@ -96,7 +96,7 @@ public define DB_Table production_macaddress_table = | ||
| 96 | db_table("production_macaddress", | 96 | db_table("production_macaddress", |
| 97 | db_model( | 97 | db_model( |
| 98 | [ | 98 | [ |
| 99 | - db_column("id", p_key, []), | 99 | + |
| 100 | db_column("mac", char_field(20), []), | 100 | db_column("mac", char_field(20), []), |
| 101 | db_column("index", integer_field, []), | 101 | db_column("index", integer_field, []), |
| 102 | db_column("mailfountain_id", integer_field, []), | 102 | db_column("mailfountain_id", integer_field, []), |
| @@ -105,51 +105,73 @@ public define DB_Table production_macaddress_table = | @@ -105,51 +105,73 @@ public define DB_Table production_macaddress_table = | ||
| 105 | ), | 105 | ), |
| 106 | db_display( | 106 | db_display( |
| 107 | //list_view | 107 | //list_view |
| 108 | - ["id", "mac", "index", "mailfountain_id"], | 108 | + [ "mac", "index", "mailfountain_id"], |
| 109 | //list edit | 109 | //list edit |
| 110 | ["mac", "index", "mailfountain_id"] | 110 | ["mac", "index", "mailfountain_id"] |
| 111 | ) | 111 | ) |
| 112 | ). | 112 | ). |
| 113 | - | ||
| 114 | -public define DB_Table production_memory_type_table = | ||
| 115 | - db_table("production_memory_type", | 113 | + |
| 114 | +public define DB_Table production_mass_storage_type_table = | ||
| 115 | + db_table("production_mass_storage_type", | ||
| 116 | db_model( | 116 | db_model( |
| 117 | [ | 117 | [ |
| 118 | - db_column("id", p_key, []), | 118 | + |
| 119 | db_column("type", char_field(20), []), | 119 | db_column("type", char_field(20), []), |
| 120 | ], | 120 | ], |
| 121 | "to_String(obj.id)+\":\"+obj.type" | 121 | "to_String(obj.id)+\":\"+obj.type" |
| 122 | ), | 122 | ), |
| 123 | db_display( | 123 | db_display( |
| 124 | //list_view | 124 | //list_view |
| 125 | - ["id", "type"], | 125 | + [ "type"], |
| 126 | //list edit | 126 | //list edit |
| 127 | ["type"] | 127 | ["type"] |
| 128 | ) | 128 | ) |
| 129 | ). | 129 | ). |
| 130 | + | ||
| 130 | 131 | ||
| 131 | -public define DB_Table production_mass_storage_type_table = | ||
| 132 | - db_table("production_mass_storage_type", | 132 | + |
| 133 | +public define DB_Table production_mass_storage_table = | ||
| 134 | + db_table("production_mass_storage", | ||
| 133 | db_model( | 135 | db_model( |
| 134 | [ | 136 | [ |
| 135 | - db_column("id", p_key, []), | ||
| 136 | - db_column("type", char_field(20), []), | 137 | + |
| 138 | + db_column("purchase_id", foreign_key("production_purchase"), [indexed]), | ||
| 139 | + db_column("model_id", foreign_key("production_mass_storage_model"), [indexed]), | ||
| 140 | + db_column("serial", char_field(40), []), // | ||
| 141 | + db_column("status", char_field(10), []), // | ||
| 142 | + db_column("date_created", datetime_field(auto_now_add), []), | ||
| 143 | + db_column("last_modified", datetime_field(auto_now), []), | ||
| 144 | + db_column("comments", text_field, []) // whatever the user wants to keep | ||
| 137 | ], | 145 | ], |
| 138 | - "to_String(obj.id)+\":\"+obj.type" | 146 | + "obj.serial" |
| 139 | ), | 147 | ), |
| 140 | db_display( | 148 | db_display( |
| 141 | //list_view | 149 | //list_view |
| 142 | - ["id", "type"], | ||
| 143 | - //list edit | ||
| 144 | - ["type"] | 150 | + ["model_id", "serial", "status", "date_created"], |
| 151 | + //list_edit | ||
| 152 | + ["purchase_id", "model_id", "serial", "status", "comments"] | ||
| 145 | ) | 153 | ) |
| 146 | ). | 154 | ). |
| 147 | - | 155 | + |
| 156 | + "CREATE TABLE production_purchase ( | ||
| 157 | + id integer NOT NULL PRIMARY KEY, | ||
| 158 | + date date NOT NULL, | ||
| 159 | + buyer_id integer NOT NULL REFERENCES staff_staff (id), | ||
| 160 | + supplier_id integer NOT NULL REFERENCES production_supplier (id), | ||
| 161 | + order_ref varchar(50) NOT NULL, | ||
| 162 | + description varchar(200) NOT NULL, | ||
| 163 | + date_created datetime NOT NULL, | ||
| 164 | + last_modified datetime NOT NULL, | ||
| 165 | + comments text NOT NULL | ||
| 166 | + )" | ||
| 167 | + | ||
| 168 | + | ||
| 169 | + | ||
| 148 | public define DB_Table production_mass_storage_model_table = | 170 | public define DB_Table production_mass_storage_model_table = |
| 149 | db_table("production_mass_storage_model", | 171 | db_table("production_mass_storage_model", |
| 150 | db_model( | 172 | db_model( |
| 151 | [ | 173 | [ |
| 152 | - db_column("id", p_key, []), | 174 | + |
| 153 | db_column("manufacturer", char_field(20), []), | 175 | db_column("manufacturer", char_field(20), []), |
| 154 | db_column("type_id", foreign_key("production_mass_storage_type"), [indexed]), | 176 | db_column("type_id", foreign_key("production_mass_storage_type"), [indexed]), |
| 155 | db_column("capacity", integer_field, []), // | 177 | db_column("capacity", integer_field, []), // |
| @@ -162,52 +184,284 @@ public define DB_Table production_mass_storage_model_table = | @@ -162,52 +184,284 @@ public define DB_Table production_mass_storage_model_table = | ||
| 162 | ), | 184 | ), |
| 163 | db_display( | 185 | db_display( |
| 164 | //list_view | 186 | //list_view |
| 165 | - ["id", "manufacturer", "type_id", "capacity", "tr_min", "last_modified", "date_created"], | 187 | + [ "manufacturer", "type_id", "capacity", "tr_min", "last_modified", "date_created"], |
| 166 | //list_edit | 188 | //list_edit |
| 167 | [] | 189 | [] |
| 168 | ) | 190 | ) |
| 169 | ). | 191 | ). |
| 192 | + | ||
| 193 | +public define DB_Table production_memory_table = | ||
| 194 | + db_table("production_memory", | ||
| 195 | + db_model( | ||
| 196 | + [ | ||
| 197 | + | ||
| 198 | + db_column("purchase_id", foreign_key("production_purchase"), [indexed]), | ||
| 199 | + db_column("model_id", foreign_key("production_memory_model"), [indexed]), | ||
| 200 | + db_column("serial", char_field(40), []), // | ||
| 201 | + db_column("status", char_field(10), []), // | ||
| 202 | + db_column("date_created", datetime_field(auto_now_add), []), | ||
| 203 | + db_column("last_modified", datetime_field(auto_now), []), | ||
| 204 | + db_column("comments", text_field, []) // whatever the user wants to keep | ||
| 205 | + ], | ||
| 206 | + "obj.serial" | ||
| 207 | + ), | ||
| 208 | + db_display( | ||
| 209 | + //list_view | ||
| 210 | + [ "serial", "status", "last_modified", "date_created"], | ||
| 211 | + //list_edit | ||
| 212 | + ["purchase_id", "model_id", "serial", "status", "last_modified", "date_created", "comments"] | ||
| 213 | + ) | ||
| 214 | + ). | ||
| 215 | + | ||
| 216 | +public define DB_Table production_memory_model_table = | ||
| 217 | + db_table("production_memory_model", | ||
| 218 | + db_model( | ||
| 219 | + [ | ||
| 220 | + | ||
| 221 | + db_column("type_id", foreign_key("production_memory_type"), [indexed]), | ||
| 222 | + db_column("manufacturer", char_field(20), []), // | ||
| 223 | + db_column("capacity", integer_field, []) // | ||
| 224 | + ], | ||
| 225 | + "obj.manufacturer" | ||
| 226 | + ), | ||
| 227 | + db_display( | ||
| 228 | + //list_view | ||
| 229 | + [ "type_id", "manufacturer", "capacity"], | ||
| 230 | + //list_edit | ||
| 231 | + ["type_id", "manufacturer", "capacity"] | ||
| 232 | + ) | ||
| 233 | + ). | ||
| 170 | 234 | ||
| 171 | -public define DB_Table production_mass_storage_table = | ||
| 172 | - db_table("production_mass_storage", | 235 | +public define DB_Table production_memory_type_table = |
| 236 | + db_table("production_memory_type", | ||
| 173 | db_model( | 237 | db_model( |
| 174 | [ | 238 | [ |
| 175 | - db_column("id", p_key, []), | ||
| 176 | - db_column("purchase_id", foreign_key("production_purchase"), [indexed]), | ||
| 177 | - db_column("model_id", foreign_key("production_mass_storage_model"), [indexed]), | 239 | + |
| 240 | + db_column("type", char_field(20), []), | ||
| 241 | + ], | ||
| 242 | + "to_String(obj.id)+\":\"+obj.type" | ||
| 243 | + ), | ||
| 244 | + db_display( | ||
| 245 | + //list_view | ||
| 246 | + [ "type"], | ||
| 247 | + //list edit | ||
| 248 | + ["type"] | ||
| 249 | + ) | ||
| 250 | + ). | ||
| 251 | + | ||
| 252 | +public define DB_Table production_motherboard_table = | ||
| 253 | + db_table("production_motherboard", | ||
| 254 | + db_model( | ||
| 255 | + [ | ||
| 256 | + | ||
| 257 | + db_column("purchase_id", foreign_key("production_purchase"), [indexed]), | ||
| 258 | + db_column("model_id", foreign_key("production_motherboard_model"), [indexed]), | ||
| 178 | db_column("serial", char_field(40), []), // | 259 | db_column("serial", char_field(40), []), // |
| 179 | - db_column("status", char_field(10), []), // | 260 | + db_column("week_fab", char_field(10), []), // |
| 261 | + db_column("status", char_field(10), []), // | ||
| 180 | db_column("date_created", datetime_field(auto_now_add), []), | 262 | db_column("date_created", datetime_field(auto_now_add), []), |
| 181 | db_column("last_modified", datetime_field(auto_now), []), | 263 | db_column("last_modified", datetime_field(auto_now), []), |
| 182 | db_column("comments", text_field, []) // whatever the user wants to keep | 264 | db_column("comments", text_field, []) // whatever the user wants to keep |
| 183 | ], | 265 | ], |
| 184 | - "obj.purchase_id.string" | 266 | + "obj.serial" |
| 185 | ), | 267 | ), |
| 186 | db_display( | 268 | db_display( |
| 187 | //list_view | 269 | //list_view |
| 188 | - ["model_id", "serial", "status", "date_created"], | 270 | + [ "serial", "week_fab", "status", "last_modified", "date_created"], |
| 189 | //list_edit | 271 | //list_edit |
| 190 | - ["purchase_id", "model_id", "serial", "status", "comments"] | 272 | + ["purchase_id", "model_id", "serial", "week_fab", "status", "last_modified", "date_created", "comments"] |
| 191 | ) | 273 | ) |
| 192 | ). | 274 | ). |
| 193 | - | ||
| 194 | - "CREATE TABLE production_purchase ( | ||
| 195 | - id integer NOT NULL PRIMARY KEY, | ||
| 196 | - date date NOT NULL, | ||
| 197 | - buyer_id integer NOT NULL REFERENCES staff_staff (id), | ||
| 198 | - supplier_id integer NOT NULL REFERENCES production_supplier (id), | ||
| 199 | - order_ref varchar(50) NOT NULL, | ||
| 200 | - description varchar(200) NOT NULL, | ||
| 201 | - date_created datetime NOT NULL, | ||
| 202 | - last_modified datetime NOT NULL, | ||
| 203 | - comments text NOT NULL | ||
| 204 | - )" | 275 | + |
| 276 | +public define DB_Table production_motherboard_model_table = | ||
| 277 | + db_table("production_motherboard_model", | ||
| 278 | + db_model( | ||
| 279 | + [ | ||
| 280 | + | ||
| 281 | + db_column("name", char_field(30), []), | ||
| 282 | + db_column("manufacturer", char_field(20), []), | ||
| 283 | + db_column("has_nand", boolean_field, []), | ||
| 284 | + db_column("nand_capacity", integer_field, []), // | ||
| 285 | + db_column("memory", integer_field, []), // | ||
| 286 | + db_column("cpu_freq", integer_field, []), // | ||
| 287 | + db_column("cpu_model", char_field(30), []), | ||
| 288 | + db_column("endian", char_field(1), []) // whatever the user wants to keep | ||
| 289 | + ], | ||
| 290 | + "obj.name" | ||
| 291 | + ), | ||
| 292 | + db_display( | ||
| 293 | + //list_view | ||
| 294 | + ["name", "manufacturer", "cpu_model", "cpu_freq"], | ||
| 295 | + //list_edit | ||
| 296 | + ["name", "manufacturer", "has_nand", "nand_capacity", "memory", "cpu_freq", "cpu_model", "endian"] | ||
| 297 | + ) | ||
| 298 | + ). | ||
| 299 | + | ||
| 300 | +public define DB_Table production_power_supply_table = | ||
| 301 | + db_table("production_power_supply", | ||
| 302 | + db_model( | ||
| 303 | + [ | ||
| 304 | + | ||
| 305 | + db_column("purchase_id", foreign_key("production_purchase"), [indexed]), | ||
| 306 | + db_column("model_id", foreign_key("production_power_supply_model"), [indexed]), | ||
| 307 | + db_column("serial", char_field(40), []), // | ||
| 308 | + db_column("status", char_field(10), []), // | ||
| 309 | + db_column("date_created", datetime_field(auto_now_add), []), | ||
| 310 | + db_column("last_modified", datetime_field(auto_now), []), | ||
| 311 | + db_column("comments", text_field, []) // whatever the user wants to keep | ||
| 312 | + ], | ||
| 313 | + "obj.serial" | ||
| 314 | + ), | ||
| 315 | + db_display( | ||
| 316 | + //list_view | ||
| 317 | + [ "serial", "status", "date_created", "last_modified"], | ||
| 318 | + //list_edit | ||
| 319 | + ["purchase_id", "model_id", "serial", "status", "date_created", "last_modified", "comments"] | ||
| 320 | + ) | ||
| 321 | + ). | ||
| 322 | + | ||
| 323 | +public define DB_Table production_power_supply_model_table = | ||
| 324 | + db_table("production_power_supply_model", | ||
| 325 | + db_model( | ||
| 326 | + [ | ||
| 327 | + | ||
| 328 | + db_column("name", char_field(30), []), | ||
| 329 | + db_column("manufacturer", char_field(20), []), | ||
| 330 | + db_column("power", integer_field, []) | ||
| 331 | + ], | ||
| 332 | + "obj.name" | ||
| 333 | + ), | ||
| 334 | + db_display( | ||
| 335 | + //list_view | ||
| 336 | + [ "name", "manufacturer"], | ||
| 337 | + //list_edit | ||
| 338 | + ["name", "manufacturer", "power"] | ||
| 339 | + ) | ||
| 340 | + ). | ||
| 341 | + | ||
| 342 | +public define DB_Table production_product_reference_table = | ||
| 343 | + db_table("production_product_reference", | ||
| 344 | + db_model( | ||
| 345 | + [ | ||
| 205 | 346 | ||
| 347 | + db_column("type_ref_id", foreign_key("production_type_number"), [indexed]), | ||
| 348 | + db_column("product_ref", char_field(4), []), | ||
| 349 | + db_column("product_name", char_field(30), []), // | ||
| 350 | + db_column("description", char_field(200), []), // | ||
| 351 | + db_column("need_memory", boolean_field, []), // | ||
| 352 | + db_column("need_power_supply", boolean_field, []), // | ||
| 353 | + db_column("need_additional_storage", boolean_field, []), // | ||
| 354 | + db_column("min_additional_storage", integer_field, []), // | ||
| 355 | + db_column("max_additional_storage", integer_field, []), // | ||
| 356 | + db_column("date_created", datetime_field(auto_now_add), []), | ||
| 357 | + db_column("last_modified", datetime_field(auto_now), []), | ||
| 358 | + db_column("comments", text_field, []) // whatever the user wants to keep | ||
| 359 | + ], | ||
| 360 | + "obj.product_ref+\":\"+obj.product_name" | ||
| 361 | + ), | ||
| 362 | + db_display( | ||
| 363 | + //list_view | ||
| 364 | + [ "type_ref_id", "product_ref", "product_name", "description"], | ||
| 365 | + //list_edit | ||
| 366 | + [ "type_ref_id", "product_ref", "product_name", "description", "need_memory", "need_power_supply", "need_additional_storage", "min_additional_storage", "max_additional_storage", | ||
| 367 | + "date_created", "last_modified", "comments"] | ||
| 368 | + ) | ||
| 369 | + ). | ||
| 370 | + | ||
| 371 | +public define DB_Table production_products_table = | ||
| 372 | + db_table("production_products", | ||
| 373 | + db_model( | ||
| 374 | + [ | ||
| 375 | + db_column("production_id", foreign_key("production_production"), []), | ||
| 376 | + db_column("produced", boolean_field, []), // | ||
| 377 | + db_column("date", date_field(none), []), | ||
| 378 | + db_column("serial", char_field(50), []), // | ||
| 379 | + db_column("security_code", char_field(50), []), // | ||
| 380 | + db_column("motherboard_id", foreign_key("production_motherboard"), []), | ||
| 381 | + db_column("storage_id", foreign_key("production_mass_storage"), []), | ||
| 382 | + db_column("memory_id", foreign_key("production_memory"), []), | ||
| 383 | + db_column("power_supply_id", foreign_key("production_power_supply"), []), | ||
| 384 | + db_column("wifi", boolean_field, []), // | ||
| 385 | + db_column("mac", char_field(20), []), | ||
| 386 | + db_column("app_id", char_field(100), []), | ||
| 387 | + db_column("os_version", char_field(20), []), | ||
| 388 | + db_column("published", boolean_field, []), | ||
| 389 | + db_column("publish_date", datetime_field(none), []), // | ||
| 390 | + db_column("status", char_field(10), []), | ||
| 391 | + db_column("date_created", datetime_field(auto_now_add), []), | ||
| 392 | + db_column("last_modified", datetime_field(auto_now), []), | ||
| 393 | + db_column("comments", text_field, []) // whatever the user wants to keep | ||
| 394 | + ], | ||
| 395 | + "obj.serial" | ||
| 396 | + ), | ||
| 397 | + db_display( | ||
| 398 | + //list_view | ||
| 399 | + [ "production_id", "date", "serial", "motherboard_id", "app_id", "status"], | ||
| 400 | + //list_edit | ||
| 401 | + [ "production_id", "produced", "date", "serial", "security_code", "motherboard_id", "storage_id", "memory_id", "power_supply_id", "wifi", "mac", | ||
| 402 | + "app_id", "os_version", "published", "publish_date", "status", "date_created", "last_modified", "comments"] | ||
| 403 | + ) | ||
| 404 | + ). | ||
| 405 | + | ||
| 406 | +public define DB_Table production_production_table = | ||
| 407 | + db_table("production_production", | ||
| 408 | + db_model( | ||
| 409 | + [ | ||
| 410 | + | ||
| 411 | + db_column("date", date_field(none), []), | ||
| 412 | + db_column("assembler_id", foreign_key("staff_staff"), []), | ||
| 413 | + db_column("type_ref_id", foreign_key("production_type_number"), []), | ||
| 414 | + db_column("product_ref_id", foreign_key("production_product_reference"), []), | ||
| 415 | + db_column("site_id", foreign_key("production_production_site"), []), | ||
| 416 | + db_column("serial_prefix_id", foreign_key("production_serial_prefix"), []), | ||
| 417 | + db_column("sticker_tpl_id", foreign_key("production_type_number"), []), | ||
| 418 | + db_column("starting_index", integer_field, []), // | ||
| 419 | + db_column("product_count", integer_field, []), // | ||
| 420 | + db_column("produced_count", integer_field, []), // | ||
| 421 | + db_column("completed", boolean_field, []), // | ||
| 422 | + db_column("active", boolean_field, []), // | ||
| 423 | + db_column("date_created", datetime_field(auto_now_add), []), | ||
| 424 | + db_column("last_modified", datetime_field(auto_now), []), | ||
| 425 | + db_column("comments", text_field, []) // whatever the user wants to keep | ||
| 426 | + ], | ||
| 427 | + "date(obj.date)" | ||
| 428 | + ), | ||
| 429 | + db_display( | ||
| 430 | + //list_view | ||
| 431 | + [ "date", "type_ref_id", "sticker_tpl_id", "product_ref_id", "site_id", "product_count", "produced_count"], | ||
| 432 | + //list_edit | ||
| 433 | + [ "date", "assembler_id", "type_ref_id", "product_ref_id", "site_id", "serial_prefix_id", "sticker_tpl_id", "starting_index", "product_count", "produced_count", "completed", | ||
| 434 | + "active", "date_created", "last_modified", "comments"] | ||
| 435 | + ) | ||
| 436 | + ). | ||
| 437 | + | ||
| 438 | +public define DB_Table production_production_site_table = | ||
| 439 | + db_table("production_production_site", | ||
| 440 | + db_model( | ||
| 441 | + [ | ||
| 442 | + db_column("ref", char_field(3), []), | ||
| 443 | + db_column("name", char_field(50), []), | ||
| 444 | + db_column("city", char_field(30), []), | ||
| 445 | + db_column("country", char_field(30), []), | ||
| 446 | + db_column("next_serial", integer_field, []), | ||
| 447 | + db_column("date_created", datetime_field(auto_now_add), []), | ||
| 448 | + db_column("last_modified", datetime_field(auto_now), []), | ||
| 449 | + db_column("comments", text_field, []) // whatever the user wants to keep | ||
| 450 | + ], | ||
| 451 | + "obj.ref+\":\"+obj.name" | ||
| 452 | + ), | ||
| 453 | + db_display( | ||
| 454 | + //list_view | ||
| 455 | + [ "ref", "name", "city", "country"], | ||
| 456 | + //list_edit | ||
| 457 | + [ "ref", "name", "city", "country", "next_serial", "date_created", "last_modified", "comments"] | ||
| 458 | + ) | ||
| 459 | + ). | ||
| 460 | + | ||
| 206 | public define DB_Table production_purchase_table = | 461 | public define DB_Table production_purchase_table = |
| 207 | db_table("production_purchase", | 462 | db_table("production_purchase", |
| 208 | db_model( | 463 | db_model( |
| 209 | [ | 464 | [ |
| 210 | - db_column("id", p_key, []), | ||
| 211 | db_column("date", date_field(none), []), | 465 | db_column("date", date_field(none), []), |
| 212 | db_column("buyer_id", foreign_key("staff_staff"), [indexed]), | 466 | db_column("buyer_id", foreign_key("staff_staff"), [indexed]), |
| 213 | db_column("supplier_id", foreign_key("production_supplier"), [indexed]), | 467 | db_column("supplier_id", foreign_key("production_supplier"), [indexed]), |
| @@ -217,7 +471,7 @@ public define DB_Table production_purchase_table = | @@ -217,7 +471,7 @@ public define DB_Table production_purchase_table = | ||
| 217 | db_column("last_modified", datetime_field(auto_now), []), | 471 | db_column("last_modified", datetime_field(auto_now), []), |
| 218 | db_column("comments", text_field, []), // whatever the user wants to keep | 472 | db_column("comments", text_field, []), // whatever the user wants to keep |
| 219 | ], | 473 | ], |
| 220 | - "" | 474 | + "date(obj.date)" |
| 221 | ), | 475 | ), |
| 222 | db_display( | 476 | db_display( |
| 223 | //list_view | 477 | //list_view |
| @@ -226,19 +480,212 @@ public define DB_Table production_purchase_table = | @@ -226,19 +480,212 @@ public define DB_Table production_purchase_table = | ||
| 226 | ["date", "buyer_id", "supplier_id", "order_ref", "description", "comments"] | 480 | ["date", "buyer_id", "supplier_id", "order_ref", "description", "comments"] |
| 227 | ) | 481 | ) |
| 228 | ). | 482 | ). |
| 483 | + | ||
| 484 | +public define DB_Table production_serial_prefix_table = | ||
| 485 | + db_table("production_serial_prefix", | ||
| 486 | + db_model( | ||
| 487 | + [ | ||
| 488 | + | ||
| 489 | + db_column("prefix", char_field(3), []), | ||
| 490 | + db_column("next_start", integer_field, []) | ||
| 491 | + ], | ||
| 492 | + "obj.prefix" | ||
| 493 | + ), | ||
| 494 | + db_display( | ||
| 495 | + //list_view | ||
| 496 | + ["prefix", "next_start"], | ||
| 497 | + //list_edit | ||
| 498 | + ["prefix", "next_start"] | ||
| 499 | + ) | ||
| 500 | + ). | ||
| 501 | + | ||
| 502 | +public define DB_Table production_type_number_table = | ||
| 503 | + db_table("production_type_number", | ||
| 504 | + db_model( | ||
| 505 | + [ | ||
| 506 | + | ||
| 507 | + db_column("type_ref", char_field(3), []), | ||
| 508 | + db_column("description", text_field, []), | ||
| 509 | + db_column("date_created", datetime_field(auto_now_add), []), | ||
| 510 | + db_column("last_modified", datetime_field(auto_now), []), | ||
| 511 | + db_column("comments", text_field, []) // whatever the user wants to keep | ||
| 512 | + ], | ||
| 513 | + "obj.type_ref+\":\"+obj.description" | ||
| 514 | + ), | ||
| 515 | + db_display( | ||
| 516 | + //list_view | ||
| 517 | + [ "type_ref", "description"], | ||
| 518 | + //list_edit | ||
| 519 | + ["type_ref", "description", "comments"] | ||
| 520 | + ) | ||
| 521 | + ). | ||
| 522 | + | ||
| 523 | +public define DB_Table production_supplier_table = | ||
| 524 | + db_table("production_supplier", | ||
| 525 | + db_model( | ||
| 526 | + [ | ||
| 229 | 527 | ||
| 528 | + db_column("company", char_field(100), []), | ||
| 529 | + db_column("contact_id", foreign_key("address_book_contact"), []), | ||
| 530 | + db_column("address1", char_field(100), []), | ||
| 531 | + db_column("address2", char_field(100), []), | ||
| 532 | + db_column("zipcode", char_field(10), []), | ||
| 533 | + db_column("city", char_field(50), []), | ||
| 534 | + db_column("country", char_field(50), []), | ||
| 535 | + db_column("email", char_field(75), []), | ||
| 536 | + db_column("url", char_field(200), []), | ||
| 537 | + db_column("phone", char_field(20), []), | ||
| 538 | + db_column("fax", char_field(20), []), | ||
| 539 | + db_column("mobile", char_field(20), []), | ||
| 540 | + db_column("siret", char_field(50), []), | ||
| 541 | + db_column("tva_number", char_field(50), []), | ||
| 542 | + db_column("date_created", datetime_field(auto_now_add), []), | ||
| 543 | + db_column("last_modified", datetime_field(auto_now), []), | ||
| 544 | + db_column("comments", text_field, []) // whatever the user wants to keep | ||
| 545 | + ], | ||
| 546 | + "obj.company" | ||
| 547 | + ), | ||
| 548 | + db_display( | ||
| 549 | + //list_view | ||
| 550 | + [ "company", "phone", "mobile", "email"], | ||
| 551 | + //list_edit | ||
| 552 | + ["company", "supplier_id", "address1", "address2", "zipcode", "city", "country", "email", "url", "phone", "fax", "mobile", | ||
| 553 | + "siret", "tva_number", "date_created", "last_modified", "comments"] | ||
| 554 | + ) | ||
| 555 | + ). | ||
| 556 | + | ||
| 557 | + | ||
| 558 | +public define DB_Table staff_department_table = | ||
| 559 | + db_table("staff_department", | ||
| 560 | + db_model( | ||
| 561 | + [ | ||
| 562 | + | ||
| 563 | + db_column("name", char_field(50), []), | ||
| 564 | + db_column("description", text_field, []), | ||
| 565 | + db_column("date_created", datetime_field(auto_now_add), []), | ||
| 566 | + db_column("last_modified", datetime_field(auto_now), []), | ||
| 567 | + db_column("comments", text_field, []) // whatever the user wants to keep | ||
| 568 | + ], | ||
| 569 | + "obj.name" | ||
| 570 | + ), | ||
| 571 | + db_display( | ||
| 572 | + //list_view | ||
| 573 | + [ "name"], | ||
| 574 | + //list_edit | ||
| 575 | + ["name", "description", "comments"] | ||
| 576 | + ) | ||
| 577 | + ). | ||
| 578 | + | ||
| 579 | + | ||
| 580 | +public define DB_Table staff_role_table = | ||
| 581 | + db_table("staff_role", | ||
| 582 | + db_model( | ||
| 583 | + [ | ||
| 584 | + db_column("role_name", char_field(50), []), | ||
| 585 | + db_column("description", text_field, []), | ||
| 586 | + db_column("date_created", datetime_field(auto_now_add), []), | ||
| 587 | + db_column("last_modified", datetime_field(auto_now), []), | ||
| 588 | + db_column("comments", text_field, []) // whatever the user wants to keep | ||
| 589 | + ], | ||
| 590 | + "obj.role_name" | ||
| 591 | + ), | ||
| 592 | + db_display( | ||
| 593 | + //list_view | ||
| 594 | + [ "role_name"], | ||
| 595 | + //list_edit | ||
| 596 | + ["role_name", "description", "comments"] | ||
| 597 | + ) | ||
| 598 | + ). | ||
| 599 | + | ||
| 600 | +public define DB_Table staff_staff_table = | ||
| 601 | + db_table("staff_staff", | ||
| 602 | + db_model( | ||
| 603 | + [ | ||
| 604 | + | ||
| 605 | + db_column("contact_id", foreign_key("address_book_contact"), [indexed]), | ||
| 606 | + db_column("department_id", foreign_key("staff_department"), [indexed]), | ||
| 607 | + db_column("role_id", foreign_key("staff_role"), [indexed]), | ||
| 608 | + db_column("email", char_field(75), []), | ||
| 609 | + db_column("incoming_date", date_field(none), []), // | ||
| 610 | + db_column("outgoing_date", date_field(none), [], help_text("if not still present in company. The date of official outgoing")), // | ||
| 611 | + db_column("still_present", boolean_field, [], help_text("Still working for the company")), | ||
| 612 | + db_column("date_created", datetime_field(auto_now_add), []), | ||
| 613 | + db_column("last_modified", datetime_field(auto_now), []), | ||
| 614 | + db_column("comments", text_field, []) // whatever the user wants to keep | ||
| 615 | + ], | ||
| 616 | + "obj.email" | ||
| 617 | + ), | ||
| 618 | + db_display( | ||
| 619 | + //list_view | ||
| 620 | + [ "contact_id", "department_id", "role_id", "email"], | ||
| 621 | + //list_edit | ||
| 622 | + ["contact_id", "department_id", "role_id", "email", "incoming_date", "outgoing_date", "still_present", "date_created", "date_modified", "comments"] | ||
| 623 | + ) | ||
| 624 | + ). | ||
| 625 | + | ||
| 626 | +public define DB_Table address_book_contact_table = | ||
| 627 | + db_table("address_book_contact", | ||
| 628 | + db_model( | ||
| 629 | + [ | ||
| 630 | + | ||
| 631 | + db_column("first_name", char_field(50), []), | ||
| 632 | + db_column("last_name", char_field(50), []), | ||
| 633 | + db_column("company", char_field(100), []), | ||
| 634 | + db_column("role", char_field(50), []), | ||
| 635 | + db_column("address1", char_field(100), []), | ||
| 636 | + db_column("address2", char_field(100), []), | ||
| 637 | + db_column("zipcode", char_field(10), []), | ||
| 638 | + db_column("city", char_field(50), []), | ||
| 639 | + db_column("country", char_field(50), []), | ||
| 640 | + db_column("email", char_field(75), []), | ||
| 641 | + db_column("url", char_field(200), []), | ||
| 642 | + db_column("phone", char_field(20), []), | ||
| 643 | + db_column("fax", char_field(20), []), | ||
| 644 | + db_column("mobile", char_field(20), []), | ||
| 645 | + db_column("date_created", datetime_field(auto_now_add), []), | ||
| 646 | + db_column("last_modified", datetime_field(auto_now), []), | ||
| 647 | + db_column("comments", text_field, []) // whatever the user wants to keep | ||
| 648 | + ], | ||
| 649 | + "obj.first_name +\" \"+obj.last_name " | ||
| 650 | + ), | ||
| 651 | + db_display( | ||
| 652 | + //list_view | ||
| 653 | + [ "first_name", "last_name", "company", "phone", "mobile", "email"], | ||
| 654 | + //list_edit | ||
| 655 | + ["first_name", "last_name", "company", "role", "address1", "address2", "zipcode", "city", "country", "email", "url", "phone", "fax", "mobile", "comments"] | ||
| 656 | + ) | ||
| 657 | + ). | ||
| 658 | + | ||
| 230 | public define DB_Database | 659 | public define DB_Database |
| 231 | the_database_description | 660 | the_database_description |
| 232 | = | 661 | = |
| 233 | db_database("prod_manager", | 662 | db_database("prod_manager", |
| 234 | [ | 663 | [ |
| 235 | - mf_serial_table | ||
| 236 | - /*settings_table, | 664 | + //domain manager |
| 665 | + //mf_serial_table | ||
| 666 | + settings_table, | ||
| 667 | + production_mass_storage_table, | ||
| 237 | production_mass_storage_type_table, | 668 | production_mass_storage_type_table, |
| 238 | production_mass_storage_model_table, | 669 | production_mass_storage_model_table, |
| 670 | + production_memory_table, | ||
| 671 | + production_memory_model_table, | ||
| 239 | production_memory_type_table, | 672 | production_memory_type_table, |
| 240 | production_macaddress_table, | 673 | production_macaddress_table, |
| 241 | - django_admin_log_table*/ | ||
| 242 | - //production_mass_storage_table, | ||
| 243 | - //production_purchase_table | 674 | + production_motherboard_table, |
| 675 | + production_motherboard_model_table, | ||
| 676 | + production_power_supply_table, | ||
| 677 | + production_power_supply_model_table, | ||
| 678 | + production_product_reference_table, | ||
| 679 | + production_production_table, | ||
| 680 | + production_production_site_table, | ||
| 681 | + production_products_table, | ||
| 682 | + production_purchase_table, | ||
| 683 | + production_serial_prefix_table, | ||
| 684 | + production_type_number_table, | ||
| 685 | + production_supplier_table, | ||
| 686 | + staff_department_table, | ||
| 687 | + staff_staff_table, | ||
| 688 | + staff_role_table, | ||
| 689 | + django_admin_log_table, | ||
| 690 | + address_book_contact_table | ||
| 244 | ]). | 691 | ]). |