read calexium_lib/database/model/db_model.anubis public define HK_Table mf_serial_table = hk_table("mf_serial", hk_model( [ hk_column("serial", char_field(30), []), hk_column("mac", char_field(30), []), hk_column("app_id", char_field(50), []), hk_column("enabled", boolean_field, [], help_text("Is enabled?")), hk_column("free_domain", boolean_field, [], help_text("Free domain available?")), hk_column("max_domains", integer_field, [], help_text("Maximum number of domains")), hk_column("is_demo", boolean_field, [], help_text("Is demo?")), hk_column("is_test", boolean_field, [], help_text("Is test?")), hk_column("date_created", datetime_field(auto_now_add), []), hk_column("last_updated", datetime_field(none), []), hk_column("last_ping", datetime_field(none), []), hk_column("current_ip", char_field(20), []), hk_column("mf_version", char_field(20), [], help_text("MF version")), hk_column("vm_version", char_field(20), [], help_text_TAG("ANUBIS_VM_VER")), hk_column("os_version", char_field(20), [], help_text("OS version")), hk_column("ipkg_list", text_field, []), hk_column("ifconfig", text_field, []), hk_column("dmesg", text_field, []), hk_column("memory", text_field, []), hk_column("vm_memory", text_field, []), hk_column("status", text_field, []), hk_column("disks", text_field, []), hk_column("isp_smtp", text_field, []), hk_column("description", text_field, []), hk_column("comments", text_field, []), hk_column("alert_received", boolean_field, [], help_text("Alert received?")), hk_column("alert_date", datetime_field(none), []), hk_column("alert_msg", text_field, []), hk_column("alert_mf_version", char_field(20), []), ], "obj.serial" ), hk_display( [ //list_view list_view("default", ["serial", "mf_version", "mac", "app_id", "is_demo", "is_test", "last_updated", "last_ping", "mf_version"]), ], //list of edit ( //edit_view_all ["serial", "mac", "app_id", "enabled", "free_domain", "max_domains", "is_demo", "is_test", "date_created", "last_updated", "last_ping", "current_ip", "mf_version", "os_version", "ipkg_list", "ifconfig", "dmesg", "memory", "vm_memory", "status", "disks", "isp_smtp", "description", "comments", "alert_received", "alert_date", "alert_msg", "alert_mf_version"] ) ) ). public define HK_Table settings_table = hk_table("settings", hk_model( [ hk_column("var_name", char_field(20), []), hk_column("var_value", char_field(20), []), ], "obj.var_name+\" = \"+obj.var_value" ), hk_display( //list_view [ list_view_all], //list edit ["var_name", "var_value"] ) ). public define HK_Table django_admin_log_table = hk_table("django_admin_log", hk_model( [ hk_column("action_time", datetime_field(auto_now_add), []), // hk_column("user_id", foreign_key("auth_user"), [indexed]), // hk_column("content_type_id", foreign_key("django_content_type"), [indexed]), hk_column("user_id", integer_field, []), hk_column("content_type_id", integer_field, []), hk_column("object_id", text_field, []), hk_column("object_repr", char_field(200), []), hk_column("action_flag", integer_field, []), hk_column("change_message", text_field, []), ], "obj.object_repr" ), hk_display( //list_view [ list_view_all], //list edit ["action_time", "user_id", "content_type_id", "object_id", "object_repr", "action_flag", "change_message"] ) ). public define HK_Table production_macaddress_table = hk_table("macaddress", hk_model( [ hk_column("mac", char_field(20), []), hk_column("mailfountain_id", integer_field, []), ], "obj.mac+\" = MailFountain[\"+obj.mailfountain_id+\"]\"" ), hk_display( //list_view [ list_view_all], //list edit ["mac", "index", "mailfountain_id"] ) ). public define HK_Table production_mass_storage_type_table = hk_table("mass_storage_type", hk_model( [ hk_column("type", char_field(20), []), ], "to_String(obj.id)+\":\"+obj.type" ), hk_display( //list_view [ list_view_all], //list edit ["type"] ) ). public define HK_Table production_mass_storage_table = hk_table("mass_storage", hk_model( [ hk_column("purchase_id", foreign_key("purchase"), [indexed]), hk_column("model_id", foreign_key("mass_storage_model"), [indexed]), hk_column("serial", char_field(40), []), // hk_column("status", char_field(10), []), // hk_column("date_created", datetime_field(auto_now_add), []), hk_column("last_modified", datetime_field(auto_now), []), hk_column("comments", text_field, []) // whatever the user wants to keep ], "obj.serial" ), hk_display( //list_view [ list_view("current",["model_id", "serial", "status", "date_created"]) ], //list_edit ["purchase_id", "model_id", "serial", "status", "comments"] ) ). "CREATE TABLE production_purchase ( id integer NOT NULL PRIMARY KEY, date date NOT NULL, buyer_id integer NOT NULL REFERENCES staff_staff (id), supplier_id integer NOT NULL REFERENCES production_supplier (id), order_ref varchar(50) NOT NULL, description varchar(200) NOT NULL, date_created datetime NOT NULL, last_modified datetime NOT NULL, comments text NOT NULL )" public define HK_Table production_mass_storage_model_table = hk_table("mass_storage_model", hk_model( [ hk_column("manufacturer", char_field(20), []), hk_column("type_id", foreign_key("mass_storage_type"), [indexed]), hk_column("capacity", integer_field, []), // hk_column("tr_min", integer_field, []), // hk_column("date_created", datetime_field(auto_now_add), []), hk_column("last_modified", datetime_field(auto_now), []), hk_column("comments", text_field, []) // whatever the user wants to keep ], "obj.manufacturer" ), hk_display( //list_view [ list_view("default", ["manufacturer", "type_id", "capacity", "tr_min", "last_modified", "date_created"]) ], //list_edit [] ) ). public define HK_Table production_memory_table = hk_table("memory", hk_model( [ hk_column("purchase_id", foreign_key("purchase"), [indexed]), hk_column("model_id", foreign_key("memory_model"), [indexed]), hk_column("serial", char_field(40), []), // hk_column("status", char_field(10), []), // hk_column("date_created", datetime_field(auto_now_add), []), hk_column("last_modified", datetime_field(auto_now), []), hk_column("comments", text_field, []) // whatever the user wants to keep ], "obj.serial" ), hk_display( //list_view [ list_view("default", ["serial", "status", "last_modified", "date_created"]) ], //list_edit ["purchase_id", "model_id", "serial", "status", "last_modified", "date_created", "comments"] ) ). public define HK_Table production_memory_model_table = hk_table("memory_model", hk_model( [ hk_column("type_id", foreign_key("memory_type"), [indexed]), hk_column("manufacturer", char_field(20), []), // hk_column("capacity", integer_field, []) // ], "obj.manufacturer" ), hk_display( //list_view [ list_view_all], //list_edit ["type_id", "manufacturer", "capacity"] ) ). public define HK_Table production_memory_type_table = hk_table("memory_type", hk_model( [ hk_column("type", char_field(20), []), ], "to_String(obj.id)+\":\"+obj.type" ), hk_display( //list_view [ list_view_all], //list edit ["type"] ) ). public define HK_Table production_motherboard_table = hk_table("motherboard", hk_model( [ hk_column("purchase_id", foreign_key("purchase"), [indexed]), hk_column("model_id", foreign_key("motherboard_model"), [indexed]), hk_column("serial", char_field(40), []), // hk_column("week_fab", char_field(10), []), // hk_column("status", char_field(10), []), // hk_column("date_created", datetime_field(auto_now_add), []), hk_column("last_modified", datetime_field(auto_now), []), hk_column("comments", text_field, []) // whatever the user wants to keep ], "obj.serial" ), hk_display( //list_view [ list_view("default", ["serial", "week_fab", "status", "last_modified", "date_created"]) ], //list_edit ["purchase_id", "model_id", "serial", "week_fab", "status", "last_modified", "date_created", "comments"] ) ). public define HK_Table production_motherboard_model_table = hk_table("motherboard_model", hk_model( [ hk_column("name", char_field(30), []), hk_column("manufacturer", char_field(20), []), hk_column("has_nand", boolean_field, []), hk_column("nand_capacity", integer_field, []), // hk_column("memory", integer_field, []), // hk_column("cpu_freq", integer_field, []), // hk_column("cpu_model", char_field(30), []), hk_column("endian", char_field(1), []) // whatever the user wants to keep ], "obj.name" ), hk_display( //list_view [ list_view("default", ["name", "manufacturer", "cpu_model", "cpu_freq"]) ], //list_edit ["name", "manufacturer", "has_nand", "nand_capacity", "memory", "cpu_freq", "cpu_model", "endian"] ) ). public define HK_Table production_power_supply_table = hk_table("power_supply", hk_model( [ hk_column("purchase_id", foreign_key("purchase"), [indexed]), hk_column("model_id", foreign_key("power_supply_model"), [indexed]), hk_column("serial", char_field(40), []), // hk_column("status", char_field(10), []), // hk_column("date_created", datetime_field(auto_now_add), []), hk_column("last_modified", datetime_field(auto_now), []), hk_column("comments", text_field, []) // whatever the user wants to keep ], "obj.serial" ), hk_display( //list_view [ list_view("default", ["serial", "status", "date_created", "last_modified"]) ], //list_edit ["purchase_id", "model_id", "serial", "status", "date_created", "last_modified", "comments"] ) ). public define HK_Table production_power_supply_model_table = hk_table("power_supply_model", hk_model( [ hk_column("name", char_field(30), []), hk_column("manufacturer", char_field(20), []), hk_column("power", integer_field, []) ], "obj.name" ), hk_display( //list_view [ list_view("default", ["name", "manufacturer"]) ], //list_edit ["name", "manufacturer", "power"] ) ). public define HK_Table production_product_reference_table = hk_table("product_reference", hk_model( [ hk_column("type_ref_id", foreign_key("type_number"), [indexed]), hk_column("product_ref", char_field(4), []), hk_column("product_name", char_field(30), []), // hk_column("description", char_field(200), []), // hk_column("need_memory", boolean_field, []), // hk_column("need_power_supply", boolean_field, []), // hk_column("need_additional_storage", boolean_field, []), // hk_column("min_additional_storage", integer_field, []), // hk_column("max_additional_storage", integer_field, []), // hk_column("date_created", datetime_field(auto_now_add), []), hk_column("last_modified", datetime_field(auto_now), []), hk_column("comments", text_field, []) // whatever the user wants to keep ], "obj.product_ref+\":\"+obj.product_name" ), hk_display( //list_view [ list_view("default", ["type_ref_id", "product_ref", "product_name", "description"]) ], //list_edit [ "type_ref_id", "product_ref", "product_name", "description", "need_memory", "need_power_supply", "need_additional_storage", "min_additional_storage", "max_additional_storage", "date_created", "last_modified", "comments"] ) ). public define HK_Table production_products_table = hk_table("products", hk_model( [ hk_column("production_id", foreign_key("production"), []), hk_column("produced", boolean_field, []), // hk_column("date", date_field(none), []), hk_column("serial", char_field(50), []), // hk_column("security_code", char_field(50), []), // hk_column("motherboard_id", foreign_key("motherboard"), []), hk_column("storage_id", foreign_key("mass_storage"), []), hk_column("memory_id", foreign_key("memory"), []), hk_column("power_supply_id", foreign_key("power_supply"), []), hk_column("wifi", boolean_field, []), // hk_column("mac", char_field(20), []), hk_column("app_id", char_field(100), []), hk_column("os_version", char_field(20), []), hk_column("published", boolean_field, []), hk_column("publish_date", datetime_field(none), []), // hk_column("status", char_field(10), []), hk_column("date_created", datetime_field(auto_now_add), []), hk_column("last_modified", datetime_field(auto_now), []), hk_column("comments", text_field, []) // whatever the user wants to keep ], "obj.serial" ), hk_display( //list_view [ list_view("default", ["production_id", "date", "serial", "motherboard_id", "app_id", "status"]) ], //list_edit [ "production_id", "produced", "date", "serial", "security_code", "motherboard_id", "storage_id", "memory_id", "power_supply_id", "wifi", "mac", "app_id", "os_version", "published", "publish_date", "status", "date_created", "last_modified", "comments"] ) ). public define HK_Table production_production_table = hk_table("production", hk_model( [ hk_column("date", date_field(none), []), hk_column("assembler_id", foreign_key(app_name("staff"),"staff"), []), hk_column("type_ref_id", foreign_key("type_number"), []), hk_column("product_ref_id", foreign_key("product_reference"), []), hk_column("site_id", foreign_key("production_site"), []), hk_column("serial_prefix_id", foreign_key("serial_prefix"), []), hk_column("sticker_tpl_id", foreign_key("type_number"), []), hk_column("starting_index", integer_field, []), // hk_column("product_count", integer_field, []), // hk_column("produced_count", integer_field, []), // hk_column("completed", boolean_field, []), // hk_column("active", boolean_field, []), // hk_column("date_created", datetime_field(auto_now_add), []), hk_column("last_modified", datetime_field(auto_now), []), hk_column("comments", text_field, []) // whatever the user wants to keep ], "date(obj.date)" ), hk_display( //list_view [ list_view("default", ["date", "type_ref_id", "sticker_tpl_id", "product_ref_id", "site_id", "product_count", "produced_count"]) ], //list_edit [ "date", "assembler_id", "type_ref_id", "product_ref_id", "site_id", "serial_prefix_id", "sticker_tpl_id", "starting_index", "product_count", "produced_count", "completed", "active", "date_created", "last_modified", "comments"] ) ). public define HK_Table production_production_site_table = hk_table("production_site", hk_model( [ hk_column("ref", char_field(3), []), hk_column("name", char_field(50), []), hk_column("city", char_field(30), []), hk_column("country", char_field(30), []), hk_column("next_serial", integer_field, []), hk_column("date_created", datetime_field(auto_now_add), []), hk_column("last_modified", datetime_field(auto_now), []), hk_column("comments", text_field, []) // whatever the user wants to keep ], "obj.ref+\":\"+obj.name" ), hk_display( //list_view [ list_view("default", ["ref", "name", "city", "country"]) ], //list_edit [ "ref", "name", "city", "country", "next_serial", "date_created", "last_modified", "comments"] ) ). public define HK_Table production_purchase_table = hk_table("purchase", hk_model( [ hk_column("date", date_field(none), []), hk_column("buyer_id", foreign_key(app_name("staff"),"staff"), [indexed]), hk_column("supplier_id", foreign_key("supplier"), [indexed]), hk_column("order_ref", char_field(50), []), // hk_column("description", char_field(200), []), // description of the purchase hk_column("date_created", datetime_field(auto_now_add), []), hk_column("last_modified", datetime_field(auto_now), []), hk_column("comments", text_field, []), // whatever the user wants to keep ], "date(obj.date)" ), hk_display( //list_view [ list_view("default", ["date", "supplier_id", "description"]) ], //list_edit ["date", "buyer_id", "supplier_id", "order_ref", "description", "comments"] ) ). public define HK_Table production_serial_prefix_table = hk_table("serial_prefix", hk_model( [ hk_column("prefix", char_field(3), []), hk_column("next_start", integer_field, []) ], "obj.prefix" ), hk_display( //list_view [list_view_all], //list_edit ["prefix", "next_start"] ) ). public define HK_Table production_type_number_table = hk_table("type_number", hk_model( [ hk_column("type_ref", char_field(3), []), hk_column("description", text_field, []), hk_column("date_created", datetime_field(auto_now_add), []), hk_column("last_modified", datetime_field(auto_now), []), hk_column("comments", text_field, []) // whatever the user wants to keep ], "obj.type_ref+\":\"+obj.description" ), hk_display( //list_view [ list_view("default", ["type_ref", "description"]) ], //list_edit ["type_ref", "description", "comments"] ) ). public define HK_Table production_supplier_table = hk_table("supplier", hk_model( [ hk_column("company", char_field(100), []), hk_column("contact_id", foreign_key(none, "address_book_contact"), []), hk_column("address1", char_field(100), []), hk_column("address2", char_field(100), []), hk_column("zipcode", char_field(10), []), hk_column("city", char_field(50), []), hk_column("country", char_field(50), []), hk_column("email", char_field(75), []), hk_column("url", char_field(200), []), hk_column("phone", char_field(20), []), hk_column("fax", char_field(20), []), hk_column("mobile", char_field(20), []), hk_column("siret", char_field(50), []), hk_column("tva_number", char_field(50), []), hk_column("date_created", datetime_field(auto_now_add), []), hk_column("last_modified", datetime_field(auto_now), []), hk_column("comments", text_field, []) // whatever the user wants to keep ], "obj.company" ), hk_display( //list_view [ list_view("default", ["company", "phone", "mobile", "email"]) ], //list_edit ["company", "supplier_id", "address1", "address2", "zipcode", "city", "country", "email", "url", "phone", "fax", "mobile", "siret", "tva_number", "date_created", "last_modified", "comments"] ) ). public define HK_Table department_table = hk_table("department", hk_model( [ hk_column("name", char_field(50), []), hk_column("description", text_field, []), hk_column("date_created", datetime_field(auto_now_add), []), hk_column("last_modified", datetime_field(auto_now), []), hk_column("comments", text_field, []) // whatever the user wants to keep ], "obj.name" ), hk_display( //list_view [ list_view("default", ["name"]) ], //list_edit ["name", "description", "comments"] ) ). public define HK_Table role_table = hk_table("role", hk_model( [ hk_column("role_name", char_field(50), []), hk_column("description", text_field, []), hk_column("date_created", datetime_field(auto_now_add), []), hk_column("last_modified", datetime_field(auto_now), []), hk_column("comments", text_field, []) // whatever the user wants to keep ], "obj.role_name" ), hk_display( //list_view [ list_view("default", ["role_name"]) ], //list_edit ["role_name", "description", "comments"] ) ). public define HK_Table staff_table = hk_table("staff", hk_model( [ hk_column("contact_id", foreign_key(none, "address_book_contact"), [indexed]), hk_column("department_id", foreign_key("department"), [indexed]), hk_column("role_id", foreign_key("role"), [indexed]), hk_column("email", char_field(75), []), hk_column("incoming_date", date_field(none), []), // hk_column("outgoing_date", date_field(none), [], help_text("if not still present in company. The date of official outgoing")), // hk_column("still_present", boolean_field, [], help_text("Still working for the company")), hk_column("date_created", datetime_field(auto_now_add), []), hk_column("last_modified", datetime_field(auto_now), []), hk_column("comments", text_field, []) // whatever the user wants to keep ], "obj.email" ), hk_display( //list_view [ list_view("default", ["contact_id", "department_id", "role_id", "email"]), list_view("details", ["contact_id", "department_id", "role_id", "email", "incoming_date", "still_present"]) ], //list_edit ["contact_id", "department_id", "role_id", "email", "incoming_date", "outgoing_date", "still_present", "date_created", "date_modified", "comments"] ) ). public define HK_Table address_book_contact_table = hk_table("address_book_contact", hk_model( [ hk_column("first_name", char_field(50), []), hk_column("last_name", char_field(50), []), hk_column("company", char_field(100), []), hk_column("role", char_field(50), []), hk_column("address1", char_field(100), []), hk_column("address2", char_field(100), []), hk_column("zipcode", char_field(10), []), hk_column("city", char_field(50), []), hk_column("country", char_field(50), []), hk_column("email", char_field(75), []), hk_column("url", char_field(200), []), hk_column("phone", char_field(20), []), hk_column("fax", char_field(20), []), hk_column("mobile", char_field(20), []), hk_column("date_created", datetime_field(auto_now_add), []), hk_column("last_modified", datetime_field(auto_now), []), hk_column("comments", text_field, []) // whatever the user wants to keep ], "obj.first_name +\" \"+obj.last_name " ), hk_display( //list_view [ list_view("short", ["first_name", "last_name", "company"]), list_view("default", ["first_name", "last_name", "company", "phone", "mobile", "email"]), list_view("details", ["first_name", "last_name", "company", "url", "role", "phone", "mobile", "email", "address1", "address2", "zipcode", "city", "country"]) ], //list_edit ["first_name", "last_name", "company", "role", "address1", "address2", "zipcode", "city", "country", "email", "url", "phone", "fax", "mobile", "comments"] ) ). public define HK_Database the_database_description = hk_database("prod_manager", [ //domain manager //mf_serial_table hk_app("production", [ production_mass_storage_table, production_mass_storage_type_table, production_mass_storage_model_table, production_memory_table, production_memory_model_table, production_memory_type_table, production_macaddress_table, production_motherboard_table, production_motherboard_model_table, production_power_supply_table, production_power_supply_model_table, production_product_reference_table, production_production_table, production_production_site_table, production_products_table, production_purchase_table, production_serial_prefix_table, production_type_number_table, production_supplier_table ]), hk_app("staff", [ department_table, staff_table, role_table, ]), hk_app("", [ settings_table, django_admin_log_table, address_book_contact_table ]) ]).