Commit 2e17aca7294258382b38767762d1c07480fc5985
1 parent
fd8e2150
remove the NOT NULL always generated with foreign key. The not null is managed by column attributes
Showing
5 changed files
with
19 additions
and
61 deletions
Show diff stats
calexium_lib @ 3fbc7cca5e2
hayamiki_lib @ b0e5ce0d610
src/generation/fields.anubis
| @@ -48,7 +48,7 @@ public define String | @@ -48,7 +48,7 @@ public define String | ||
| 48 | date_field(_) then fill("DATE", 15) +format_attributes(attributes), | 48 | date_field(_) then fill("DATE", 15) +format_attributes(attributes), |
| 49 | time_field(_) then fill("TIME", 15) +format_attributes(attributes), | 49 | time_field(_) then fill("TIME", 15) +format_attributes(attributes), |
| 50 | datetime_field(_) then fill("DATETIME", 15)+format_attributes(attributes), | 50 | datetime_field(_) then fill("DATETIME", 15)+format_attributes(attributes), |
| 51 | - foreign_key(app,fk) then fill("INTEGER", 15) +" NOT NULL REFERENCES "+fk+" (id)", | 51 | + foreign_key(app,fk) then fill("INTEGER", 15) +format_attributes(attributes)+" REFERENCES "+fk+"(id) ", |
| 52 | integer_field then fill("INTEGER", 15) +format_attributes(attributes), | 52 | integer_field then fill("INTEGER", 15) +format_attributes(attributes), |
| 53 | char_field(Int size) then fill("VARCHAR("+size+")", 15) +format_attributes(attributes), | 53 | char_field(Int size) then fill("VARCHAR("+size+")", 15) +format_attributes(attributes), |
| 54 | text_field then fill("TEXT", 15) +format_attributes(attributes), | 54 | text_field then fill("TEXT", 15) +format_attributes(attributes), |
src/main.anubis
| @@ -18,10 +18,9 @@ read tools/basis.anubis | @@ -18,10 +18,9 @@ read tools/basis.anubis | ||
| 18 | read generation/files.anubis | 18 | read generation/files.anubis |
| 19 | read hayamiki_lib/hk_generator.anubis | 19 | read hayamiki_lib/hk_generator.anubis |
| 20 | read model.3.0.0.anubis | 20 | read model.3.0.0.anubis |
| 21 | +read system/muscle.anubis | ||
| 21 | 22 | ||
| 22 | - | ||
| 23 | - | ||
| 24 | -global define One | 23 | + global define One |
| 25 | hayamiki | 24 | hayamiki |
| 26 | ( | 25 | ( |
| 27 | List(String) args | 26 | List(String) args |
| @@ -29,6 +28,16 @@ global define One | @@ -29,6 +28,16 @@ global define One | ||
| 29 | if load_hk_generator is | 28 | if load_hk_generator is |
| 30 | { | 29 | { |
| 31 | failure then println("Hayamiki generator can't be load"), | 30 | failure then println("Hayamiki generator can't be load"), |
| 32 | - success(hk_gen) then forget(hk_gen.generate_model_files(the_database_description, "")) | 31 | + success(hk_gen) then forget(hk_gen.generate_model_files(domain_manager_description, "")) |
| 33 | }. | 32 | }. |
| 34 | 33 | ||
| 34 | + global define One | ||
| 35 | + hk_save | ||
| 36 | + ( | ||
| 37 | + List(String) args | ||
| 38 | + )= | ||
| 39 | + with message = to_Message(the_database_description), | ||
| 40 | + println("\n Database dump"); | ||
| 41 | + println(dump(message)) | ||
| 42 | + . | ||
| 43 | + |
src/model.3.0.0.anubis
| 1 | 1 | ||
| 2 | read hayamiki_lib/types/hayamiki.anubis | 2 | read hayamiki_lib/types/hayamiki.anubis |
| 3 | 3 | ||
| 4 | - | ||
| 5 | -public define HK_Table mf_serial_table = | ||
| 6 | - hk_table("mf_serial", | ||
| 7 | - hk_model( | ||
| 8 | - [ | ||
| 9 | - | ||
| 10 | - hk_column("serial", char_field(30), []), | ||
| 11 | - hk_column("mac", char_field(30), []), | ||
| 12 | - hk_column("app_id", char_field(50), []), | ||
| 13 | - hk_column("enabled", boolean_field, [], help_text("Is enabled?")), | ||
| 14 | - hk_column("free_domain", boolean_field, [], help_text("Free domain available?")), | ||
| 15 | - hk_column("max_domains", integer_field, [], help_text("Maximum number of domains")), | ||
| 16 | - hk_column("is_demo", boolean_field, [], help_text("Is demo?")), | ||
| 17 | - hk_column("is_test", boolean_field, [], help_text("Is test?")), | ||
| 18 | - hk_column("date_created", datetime_field(auto_now_add), []), | ||
| 19 | - hk_column("last_updated", datetime_field(none), []), | ||
| 20 | - hk_column("last_ping", datetime_field(none), []), | ||
| 21 | - hk_column("current_ip", char_field(20), []), | ||
| 22 | - hk_column("mf_version", char_field(20), [], help_text("MF version")), | ||
| 23 | - hk_column("vm_version", char_field(20), [], help_text_TAG("ANUBIS_VM_VER")), | ||
| 24 | - hk_column("os_version", char_field(20), [], help_text("OS version")), | ||
| 25 | - hk_column("ipkg_list", text_field, []), | ||
| 26 | - hk_column("ifconfig", text_field, []), | ||
| 27 | - hk_column("dmesg", text_field, []), | ||
| 28 | - hk_column("memory", text_field, []), | ||
| 29 | - hk_column("vm_memory", text_field, []), | ||
| 30 | - hk_column("status", text_field, []), | ||
| 31 | - hk_column("disks", text_field, []), | ||
| 32 | - hk_column("isp_smtp", text_field, []), | ||
| 33 | - hk_column("description", text_field, []), | ||
| 34 | - hk_column("comments", text_field, []), | ||
| 35 | - hk_column("alert_received", boolean_field, [], help_text("Alert received?")), | ||
| 36 | - hk_column("alert_date", datetime_field(none), []), | ||
| 37 | - hk_column("alert_msg", text_field, []), | ||
| 38 | - hk_column("alert_mf_version", char_field(20), []), | ||
| 39 | - ], | ||
| 40 | - "obj.serial" | ||
| 41 | - ), | ||
| 42 | - hk_display( | ||
| 43 | - | ||
| 44 | - [ | ||
| 45 | - //list_view | ||
| 46 | - list_view("default", ["serial", "mf_version", "mac", "app_id", "is_demo", "is_test", "last_updated", "last_ping", "mf_version"]), | ||
| 47 | - ], | ||
| 48 | - //list of edit | ||
| 49 | - ( | ||
| 50 | - //edit_view_all | ||
| 51 | - ["serial", "mac", "app_id", "enabled", "free_domain", "max_domains", "is_demo", "is_test", "date_created", "last_updated", "last_ping", "current_ip", "mf_version", | ||
| 52 | - "os_version", "ipkg_list", "ifconfig", "dmesg", "memory", "vm_memory", "status", "disks", "isp_smtp", "description", "comments", "alert_received", "alert_date", | ||
| 53 | - "alert_msg", "alert_mf_version"] | ||
| 54 | - ) | ||
| 55 | - ) | ||
| 56 | - ). | ||
| 57 | 4 | ||
| 58 | public define HK_Table settings_table = | 5 | public define HK_Table settings_table = |
| 59 | hk_table("settings", | 6 | hk_table("settings", |
| @@ -700,7 +647,9 @@ public define HK_Table address_book_contact_table = | @@ -700,7 +647,9 @@ public define HK_Table address_book_contact_table = | ||
| 700 | ["first_name", "last_name", "company", "role", "address1", "address2", "zipcode", "city", "country", "email", "url", "phone", "fax", "mobile", "comments"] | 647 | ["first_name", "last_name", "company", "role", "address1", "address2", "zipcode", "city", "country", "email", "url", "phone", "fax", "mobile", "comments"] |
| 701 | ) | 648 | ) |
| 702 | ). | 649 | ). |
| 703 | - | 650 | + |
| 651 | + | ||
| 652 | + | ||
| 704 | public define HK_Database | 653 | public define HK_Database |
| 705 | the_database_description | 654 | the_database_description |
| 706 | = | 655 | = |