diff --git a/calexium_lib b/calexium_lib
index 6cf67b0..dd039c8 160000
--- a/calexium_lib
+++ b/calexium_lib
@@ -1 +1 @@
-Subproject commit 6cf67b09e781c09f8475c678ba69991772066a76
+Subproject commit dd039c8079292880fce88f46ef86f3c8a967fc7f
diff --git a/hayamiki.aproj b/hayamiki.aproj
index 771a389..367b289 100644
--- a/hayamiki.aproj
+++ b/hayamiki.aproj
@@ -468,6 +468,8 @@
+
+
@@ -694,6 +696,5 @@
-
\ No newline at end of file
diff --git a/src/check.anubis b/src/check.anubis
new file mode 100644
index 0000000..2f4db93
--- /dev/null
+++ b/src/check.anubis
@@ -0,0 +1,158 @@
+/*
+ * Created by PyramIDE.
+ * User: フランスのトトロ
+ * Date: 04/02/2016
+ * Time: 22:34
+ * © Calexium
+ */
+
+read calexium_lib/database/model/db_model.anubis
+read system/string.anubis
+read tools/list.anubis
+read tools/basis.anubis
+
+public define Maybe(List(String))
+ get_all_apps_name
+ (
+ List(HK_App) apps,
+ List(String) so_far
+ )=
+ if apps is
+ {
+ [] then success(so_far),
+ [h . t] then
+ since h is hk_app(name, _),
+ if name:so_far then
+ println("The app name "+name+" already exists"); failure
+ //'this' is not allowed as app name because the
+ //else name = "this" then
+ // prinln("error: 'this' is forbidden app name "); failure
+ else
+ get_all_apps_name(t, [name. so_far])
+ }.
+
+
+define Maybe(HK_Model_Column)
+ resolve_foreign
+ (
+ List(String) apps_name,
+ String current_app_name,
+ String table_name,
+ HK_Model_Column col
+ )=
+ since col is hk_column(name, type, attrib, help),
+ if type is foreign_key(fk_app, fk_table) then
+ with mb_fk_app = if (fk_app) is
+ {
+ this then println("this found replaced by "+current_app_name+" in app '"+current_app_name+"' table '"+table_name+"' column '"+name+"'");
+ success(current_app_name),
+ app_name(_name) then
+ if _name:apps_name then
+ success(_name)
+ else
+ println("foreign key app '"+_name+"' doesn't exists in app '"+current_app_name+"' table '"+table_name+"' column '"+_name+"'");failure,
+ none then
+ success("")
+ },
+ if mb_fk_app is
+ {
+ failure then failure,
+ success(n_fk_app) then success(hk_column(name, foreign_key(if (fk_app) is app_name(_) then app_name(n_fk_app) else fk_app, (if length(n_fk_app)>0 then n_fk_app+"_"else "")+fk_table), attrib, help))
+ }
+ else
+ success(col).
+
+define Maybe(List(HK_Model_Column))
+ resolve_foreign
+ (
+ List(String) apps_name,
+ String app_name,
+ String table_name,
+ List(HK_Model_Column) columns,
+ List(HK_Model_Column) so_far
+ )=
+ if columns is
+ {
+ [] then success(reverse(so_far)),
+ [h . t] then
+ if resolve_foreign(apps_name, app_name, table_name, h) is
+ {
+ failure then failure,
+ success(col) then resolve_foreign(apps_name, app_name, table_name, t, [col. so_far])
+ }
+ }.
+
+define Maybe(List(HK_Table))
+ resolve_foreign
+ (
+ List(String) apps_name,
+ String app_name,
+ List(HK_Table) tables,
+ List(HK_Table) so_far
+ )=
+ if tables is
+ {
+ [] then success(reverse(so_far)),
+ [h . t] then
+ since h is hk_table(name, model, display),
+ since model is hk_model(columns, display_string),
+ with table_name = if length(app_name) > 0 then app_name +"_"+name else name,
+ if resolve_foreign(apps_name, app_name, table_name, columns, []) is
+ {
+ failure then failure,
+ success(checked_model) then resolve_foreign(apps_name, app_name, t, [hk_table(table_name, hk_model(checked_model, display_string), display) . so_far])
+ }
+ }.
+
+define Maybe(HK_App)
+ resolve_foreign
+ (
+ List(String) apps_name,
+ HK_App app
+ )=
+ since app is hk_app(name, tables),
+ if resolve_foreign(apps_name, name, tables, []) is
+ {
+ failure then failure,
+ success(resolved_tables) then success(hk_app(name, resolved_tables))
+ }.
+
+define Maybe(List(HK_App))
+ resolve_foreign
+ (
+ List(String) apps_name,
+ List(HK_App) apps,
+ List(HK_App) so_far
+ )=
+ if apps is
+ {
+ [] then success(reverse(so_far)),
+ [h . t] then
+ if resolve_foreign(apps_name, h) is
+ {
+ failure then failure,
+ success(app) then resolve_foreign(apps_name, t, [app . so_far])
+ }
+ }.
+
+public define Maybe(HK_Database)
+ check_database
+ (
+ HK_Database current_db //database model description
+ )=
+ since current_db is hk_database(name, apps),
+
+ if get_all_apps_name(apps, []) is
+ {
+ failure then failure,
+ success(chk_apps) then
+ if resolve_foreign(chk_apps, apps, []) is
+ {
+ failure then failure,
+ success(resolved_apps) then
+ //with checked_db = current_db,
+ success(hk_database(name, resolved_apps))
+
+ }
+ }.
+
diff --git a/src/generation/create_table.anubis b/src/generation/create_table.anubis
new file mode 100644
index 0000000..4a882ca
--- /dev/null
+++ b/src/generation/create_table.anubis
@@ -0,0 +1,232 @@
+/*
+ * Created by PyramIDE.
+ * User: フランスのトトロ aka (David RENÉ)
+ * Date: 24/01/2016
+ * Time: 18:13
+ * © Calexium
+ */
+
+
+read calexium_lib/database/model/db_model.anubis
+read tools/basis.anubis
+read tools/int.anubis
+read system/string.anubis
+read tools/streams.anubis
+read tools/ISO-8601.anubis
+
+define String
+ create_table_generate_one_column
+ (
+ HK_Model_Column column,
+ Int fill_size
+ )=
+ since column is hk_column(name, col_type, attributes, _),
+ fill(name, fill_size)+ to_SQL_CREATE(col_type, attributes)
+ .
+
+define String
+ create_table_generate_columns
+ (
+ List(HK_Model_Column) columns,
+ String indent
+ )=
+ with column_max_size = max(columns),
+ join(",\n"+indent, map((HK_Model_Column column) |-> create_table_generate_one_column(column, column_max_size+1), columns))
+ .
+
+define String
+ create_table_generate_one_table
+ (
+ HK_Table table
+ )=
+ since table is hk_table(name, model, display),
+ since model is hk_model( columns, _),
+
+ "\n"+
+ " // "+to_upper(name)+"\n"+
+ "public define String create_table_"+name+" =\n"+
+ "\"CREATE TABLE "+name+" (\n"+
+ //columns
+ " "+create_table_generate_columns([hk_column("id",p_key) . columns], " ")+
+ "\n);\".\n"
+ .
+
+define String
+ create_table_generate_all_tables
+ (
+ List(HK_App) apps, //
+ List(HK_Table) tables, //list of the table model description
+ String so_far
+ )=
+ if tables is
+ {
+ [] then
+ if apps is
+ {
+ [] then so_far,
+ [app. t_apps] then
+ since app is hk_app(name, app_tables),
+ create_table_generate_all_tables(t_apps, app_tables, so_far + "\n /************ TABLES for Application '"+name+"' ***************/")
+ },
+
+ [table . t] then
+ create_table_generate_all_tables(apps, t, so_far + create_table_generate_one_table(table))
+ }.
+
+define Int
+ longest_table_name_size
+ (
+ List(HK_App) apps,
+ Int current_size
+ )=
+ if apps is
+ {
+ [] then current_size,
+ [app . t_apps] then
+ since app is hk_app(_, tables),
+ with max_size = max(map((HK_Table table) |-> length(table.name), tables), current_size),
+ longest_table_name_size(t_apps, max_size)
+ }.
+
+define String
+ generate_all_tables_list
+ (
+ List(HK_App) apps,
+ List(HK_Table) tables, //list of the table model description
+ String indent
+ )=
+ //calculate then longest table name and add 4 for enclosed quote + coma + final space
+ //hence we can make a beautiful formatting
+ with max_space = longest_table_name_size(apps, 0) + 4,
+ join(",\n",map((HK_Table table) |-> indent+"table("+fill("\""+table.name+"\",", max_space)+"create_table_"+table.name+")", tables)).
+
+public define Maybe(One)
+ generate_create_table
+ (
+ List(HK_App) apps //list of the table model description
+ )=
+ //TODO manage version
+ with version = "1.0.0",
+ version_str = find_and_replace(version,".","_"), //replace the dot by underscore because dot is not allowed in function name by Anubis language
+
+ with file_name = "to_"+version+".anubis",
+ with script_file_name = "to_"+version+"_script.anubis",
+
+ //create script file name
+ if file(script_file_name, new) is
+ {
+ failure then println("Can't create script "+script_file_name);failure,
+ success(fd_script) then
+ with script_stream = make_stream(fd_script),
+ //write into script file the generated create table
+ if write_string(script_stream,
+"/*
+ * Created by 早見木 (Hayamiki).
+ * User: Automat
+ * Date: "+_Int_to_ISO_8601_date(now)+"
+ * Time: "+_Int_to_ISO_8601_time(now)+"
+ *
+ */
+read data_base/alter_table.anubis
+read data_base/db_types.anubis\n"+
+ //call the generation of all tables
+ create_table_generate_all_tables(apps, [], "")+
+ //TODO make indexes
+ "\npublic define List(String) db_indexes = [].\n"
+ ) is
+ {
+ failure then println ("Can't generate script "+script_file_name);failure,
+ success(_) then
+ //create file with create table management (alter_table, etc...)
+ if file(file_name, new) is
+ {
+ failure then println("can't create file "+file_name);failure,
+ success(fd) then
+ with stream = make_stream(fd),
+ write_string(stream,
+"/*
+ * Created by 早見木 (Hayamiki).
+ * User: Automat
+ * Date: "+_Int_to_ISO_8601_date(now)+"
+ * Time: "+_Int_to_ISO_8601_time(now)+"
+ *
+ */
+ *
+read tools/basis.anubis
+read system/files.anubis
+read system/logger.anubis
+read data_base/db_tools.anubis
+
+read calexium_lib/database/db_utils.anubis
+read calexium_lib/database/migration_common_sqlite3.anubis
+read calexium_lib/net_services_protocols/logger_service.anubis
+read data_base/alter_table.anubis
+
+read types/app_types.anubis
+read app/app_constants.anubis
+read app/app_loggers.anubis
+
+read database/generated/migration/to_"+version_str+"_scripts.anubis
+
+define String _version = \""+version+"\".
+
+public define Maybe(One)
+ create_v"+version_str+"_tables
+ (
+ SQLite3DataBase db,
+ Logger logger_debug
+ )=
+ if drop_all_triggers(db, logger_debug) is failure then failure else
+
+ with tables = (List(DbTable)) [
+"+generate_all_tables_list(apps, [], " ")+"
+ ],
+ if create_tables(db, logger_debug, tables, _version) is
+ {
+ failure then failure,
+ success(_) then
+ if make_foreign_keys(db, logger_debug, db_relations, _version) is failure then failure else
+ success(unique)
+ }.
+
+public define Maybe(One)
+ create_v"+version_str+"_indexes
+ (
+ SQLite3DataBase db,
+ Logger logger
+ )=
+ if create_indexes(db, logger, db_indexes, _version) is failure then failure else
+ success(unique)
+ .
+
+define Maybe(One)
+ to_v"+version_str+"_pre
+ (
+ SQLite3DataBase db,
+ Logger logger
+ )=success(unique).
+
+define Maybe(One)
+ to_v"+version_str+"_post
+ (
+ SQLite3DataBase db,
+ Logger logger
+ )=success(unique).
+
+public define Maybe(One)
+ migrate_to_v"+version_str+"
+ (
+ SQLite3DataBase db,
+ Logger logger,
+ )=
+ if to_v"+version_str+"_pre(db, logger) is failure then failure
+ else if create_v"+version_str+"_tables(db, logger) is failure then failure
+ else if to_v"+version_str+"_post(db, logger) is failure then failure
+ else create_v"+version_str+"_indexes(db, logger).
+
+
+ ")
+ }}}
+ .
+
+
diff --git a/src/generation/files.anubis b/src/generation/files.anubis
index 2622107..3b88c10 100644
--- a/src/generation/files.anubis
+++ b/src/generation/files.anubis
@@ -14,19 +14,21 @@ read tools/streams.anubis
read tools/ISO-8601.anubis
read generation/header.anubis
read generation/types.anubis
+read generation/create_table.anubis
+read check.anubis
define Maybe(One)
generate_table
(
- DB_Table org_table
+ HK_Table org_table
)
=
- since org_table is db_table(name, old_model, display),
- since old_model is db_model(columns, show_string),
+ since org_table is hk_table(name, old_model, display),
+ since old_model is hk_model(columns, show_string),
since display is db_display(list_view, list_edit),
- with model = db_model([db_column("id", p_key, []). columns], show_string ),
- with table = db_table(name, model, display),
+ with model = hk_model([hk_column("id", p_key, []). columns], show_string ),
+ with table = hk_table(name, model, display),
println("Generating file for table ["+name+"]");
with file_name = name+".anubis",
if file(file_name, new) is
@@ -48,11 +50,11 @@ define Maybe(One)
if generate_VT_edit(strm, table) is { failure then failure, success(_) then
success(unique)}}}}}}}}}}}}
}.
-
+
define One
make_all_tables
(
- List(DB_Table) tables //list of the table model description
+ List(HK_Table) tables //list of the table model description
)
=
if tables is
@@ -65,6 +67,16 @@ define One
success(_) then make_all_tables(t)
}
}.
+
+define One
+ make_all_tables
+ (
+ List(HK_App) apps
+ )=
+ map_forget((HK_App app) |-> since app is hk_app(app_name, tables),
+ println("generating tables for App ["+app_name+"]");
+ make_all_tables(tables), apps).
+
define Maybe(One)
generate_vtm_file
@@ -113,7 +125,8 @@ join("\n", transmit)+"\n\n"+
define One
_make_vtm
(
- List(DB_Table) tables, //list of the table model description
+ List(HK_App) apps, //list of application
+ List(HK_Table) tables, //list of the table model description
List(String) so_far_transmit,
List(String) so_far_view,
List(String) so_far_edit,
@@ -121,34 +134,51 @@ define One
)=
if tables is
{
- [] then forget(generate_vtm_file(so_far_transmit, so_far_view, so_far_edit, so_far_writer));println("Generation finished"),
+ [] then
+ if apps is
+ {
+ [] then forget(generate_vtm_file(so_far_transmit, so_far_view, so_far_edit, so_far_writer));println("Generation finished"),
+ [app . apps_t] then
+ _make_vtm(apps_t, app.hk_tables, so_far_transmit, so_far_view, so_far_edit, so_far_writer)
+
+ },
+
[table . t] then
- since table is db_table(name, _, _),
+ since table is hk_table(name, _, _),
with transmit = "transmit "+name+".anubis",
with view = "vtm_view(\""+name+"\", get_viewable_"+name+")",
with edit = "vtm_edit(\""+name+"\", get_editable_"+name+")",
with writer = "tm_writer(\""+name+"\", update_"+name+")",
- _make_vtm(t, [transmit . so_far_transmit], [view . so_far_view], [edit . so_far_edit], [writer . so_far_writer])
+ _make_vtm(apps, t, [transmit . so_far_transmit], [view . so_far_view], [edit . so_far_edit], [writer . so_far_writer])
}.
define One
make_vtm
(
- List(DB_Table) tables //list of the table model description
+ List(HK_App) apps //list of the applications
)
=
- _make_vtm(tables, [], [], [], []).
-
+ _make_vtm(apps, [], [], [], [], []).
+
public define One
generate_model_files
(
- DB_Database database //database model description
+ HK_Database db //database model description
)=
- since database is db_database(name, tables),
- println("Generating models for Database "+name);
- make_all_tables(tables);
- println("Generating VTM for Database "+name);
- make_vtm(tables).
+
+ if check_database(db) is
+ {
+ failure then println("Check database error"),
+ success(database) then
+ since database is hk_database(name, apps),
+ println("Generating models for Database "+name);
+ make_all_tables(apps);
+ println("Generating VTM for Database "+name);
+ make_vtm(apps);
+ println("Generating create for Database "+name);
+ if generate_create_table(apps) is failure then println("failure") else
+ unique
+ }.
diff --git a/src/generation/header.anubis b/src/generation/header.anubis
index 29091ca..528ca21 100644
--- a/src/generation/header.anubis
+++ b/src/generation/header.anubis
@@ -15,14 +15,14 @@ define Maybe(One)
foreign_table_header
(
Stream stream,
- List(DB_Model_Column) columns
+ List(HK_Model_Column) columns
)=
if columns is
{
[] then success(unique),
[h . t] then
- since h is db_column(_, type, _, _),
- if type is foreign_key(table_name) then
+ since h is hk_column(_, type, _, _),
+ if type is foreign_key(app, table_name) then
if write_string(stream, "\nread database/generated/"+table_name+".anubis") is
{
failure then failure,
@@ -39,7 +39,7 @@ public define Maybe(One)
generate_header
(
Stream stream,
- List(DB_Model_Column) columns
+ List(HK_Model_Column) columns
)=
if write_string(stream,
diff --git a/src/generation/types.anubis b/src/generation/types.anubis
index e1834ea..6d3da68 100644
--- a/src/generation/types.anubis
+++ b/src/generation/types.anubis
@@ -17,14 +17,14 @@ define List(String)
*/
_generate_type
(
- List(DB_Model_Column) columns,
+ List(HK_Model_Column) columns,
List(String) so_far
)=
if columns is
{
[] then reverse(so_far),
[h . t ] then
- since h is db_column(name, col_type, _, _),
+ since h is hk_column(name, col_type, _, _),
_generate_type(t, [ " "+fill(to_Anubis_type(col_type), 12) + " " + name . so_far])
}.
@@ -32,13 +32,13 @@ public define Maybe(One)
generate_type
(
Stream stream,
- DB_Table table
+ HK_Table table
)=
- since table is db_table(name, model, display),
- since model is db_model(columns, show_string),
+ since table is hk_table(name, model, display),
+ since model is hk_model(columns, show_string),
with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
- //generate the type of the db_table that contain all components
+ //generate the type of the HK_Table that contain all components
if write_string(stream,
"\n\npublic type "+type_name+":\n "+name+"\n (\n"+ //head of the type declaration
join(",\n",_generate_type(columns, []))+ //all components of the type
@@ -53,24 +53,24 @@ define List(String)
*/
_generate_get_default
(
- List(DB_Model_Column) columns,
+ List(HK_Model_Column) columns,
List(String) so_far
)=
if columns is
{
[] then reverse(so_far),
[h . t ] then
- since h is db_column(name, col_type, _, _),
+ since h is hk_column(name, col_type, _, _),
_generate_get_default(t, [ to_Anubis_default(col_type) . so_far])
}.
public define Maybe(One)
generate_get_default
(
Stream stream,
- DB_Table table
+ HK_Table table
)=
- since table is db_table(name, model, _),
- since model is db_model(columns, show_string),
+ since table is hk_table(name, model, _),
+ since model is hk_model(columns, show_string),
with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
//generate the type of the table that contain all components
@@ -88,7 +88,7 @@ define (List(String), Int)
*/
_generate_extract_web_arg
(
- List(DB_Model_Column) columns,
+ List(HK_Model_Column) columns,
List(String) so_far,
Int closure
)=
@@ -96,7 +96,7 @@ define (List(String), Int)
{
[] then (reverse(so_far), closure),
[h . t ] then
- since h is db_column(name, col_type, _, _),
+ since h is hk_column(name, col_type, _, _),
with result = from_web_arg(col_type, name),
//If the field is not editable no need to get it from the web
if result = "" then
@@ -112,11 +112,11 @@ define (List(String), Int)
public define Maybe(One)
generate_extract_web_arg
(
- Stream stream,
- DB_Table table
+ Stream stream,
+ HK_Table table
)=
- since table is db_table(name, model, _),
- since model is db_model(columns, _),
+ since table is hk_table(name, model, _),
+ since model is hk_model(columns, _),
with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
since _generate_extract_web_arg(columns, [], 0) is ((List(String))list_of_web_arg, (Int) nb_closure),
//generate the type of the table that contain all components
@@ -135,10 +135,10 @@ public define Maybe(One)
generate_extract_db_cursor
(
Stream stream,
- DB_Table table
+ HK_Table table
)=
- since table is db_table(name, model, display),
- since model is db_model(columns, _),
+ since table is hk_table(name, model, display),
+ since model is hk_model(columns, _),
with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
//generate the type of the table that contain all components
@@ -165,11 +165,11 @@ public define Maybe(One)
public define Maybe(One)
generate_get_all
(
- Stream stream,
- DB_Table table
+ Stream stream,
+ HK_Table table
)=
- since table is db_table(name, model, _),
- since model is db_model(columns, _),
+ since table is hk_table(name, model, _),
+ since model is hk_model(columns, _),
with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
//generate the type of the table that contain all components
@@ -208,11 +208,11 @@ public define Maybe(One)
public define Maybe(One)
generate_get_one
(
- Stream stream,
- DB_Table table
+ Stream stream,
+ HK_Table table
)=
- since table is db_table(name, model, _),
- since model is db_model(columns, show_string),
+ since table is hk_table(name, model, _),
+ since model is hk_model(columns, show_string),
with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
//generate the type of the table that contain all components
@@ -249,10 +249,10 @@ public define Maybe(One)
generate_update
(
Stream stream,
- DB_Table table
+ HK_Table table
)=
- since table is db_table(name, model, _),
- since model is db_model( columns, _),
+ since table is hk_table(name, model, _),
+ since model is hk_model( columns, _),
with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
//generate the type of the table that contain all components
@@ -305,10 +305,10 @@ public define Maybe(One)
generate_show_string
(
Stream stream,
- DB_Table table
+ HK_Table table
)=
- since table is db_table(name, model, _),
- since model is db_model( columns, show_string),
+ since table is hk_table(name, model, _),
+ since model is hk_model( columns, show_string),
with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
//generate the type of the table that contain all components
@@ -336,10 +336,10 @@ public define Maybe(One)
generate_selector
(
Stream stream,
- DB_Table table
+ HK_Table table
)=
- since table is db_table(name, model, _),
- since model is db_model( columns, show_string),
+ since table is hk_table(name, model, _),
+ since model is hk_model( columns, show_string),
with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
//generate the type of the table that contain all components
@@ -381,11 +381,11 @@ public define Maybe(One)
generate_VT_view
(
Stream stream, //stream file where to write
- DB_Table table, //
+ HK_Table table, //
HK_List_View list_view //list view to generate
)=
- since table is db_table(table_name, model, display),
- since model is db_model( columns, _),
+ since table is hk_table(table_name, model, display),
+ since model is hk_model( columns, _),
//since display is db_display(list_view, list_edit),
with type_name = to_upper(table_name, 1), //make the first character to upper case and be an Anubis Type.
@@ -444,7 +444,7 @@ public define Maybe(One)
_generate_VT_view
(
Stream stream, //stream file where to write
- DB_Table table, //
+ HK_Table table, //
List(HK_List_View) list_view, //list view to generate
Bool has_default //set to true if a default view was encountered.
)=
@@ -512,10 +512,10 @@ public define Maybe(One)
generate_get_viewable
(
Stream stream, //stream file where to write
- DB_Table table, //
+ HK_Table table, //
List(HK_List_View) list_view //list view to generate
)=
- since table is db_table(table_name, model, display),
+ since table is hk_table(table_name, model, display),
if write_string(stream,
"public define VT_view\n"+
" get_viewable_"+table_name+"\n"+
@@ -535,10 +535,10 @@ public define Maybe(One)
generate_VT_all_view
(
Stream stream,
- DB_Table table
+ HK_Table table
)=
- since table is db_table(name, model, display),
- since model is db_model( columns, _),
+ since table is hk_table(name, model, display),
+ since model is hk_model( columns, _),
since display is db_display(list_view, list_edit),
with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
@@ -553,10 +553,10 @@ public define Maybe(One)
generate_VT_edit
(
Stream stream,
- DB_Table table
+ HK_Table table
)=
- since table is db_table(name, model, display),
- since model is db_model( columns, _),
+ since table is hk_table(name, model, display),
+ since model is hk_model( columns, _),
since display is db_display(list_view, list_edit),
with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type.
diff --git a/src/model.3.0.0.anubis b/src/model.3.0.0.anubis
index 4bba1b2..0534c8b 100644
--- a/src/model.3.0.0.anubis
+++ b/src/model.3.0.0.anubis
@@ -2,40 +2,40 @@
read calexium_lib/database/model/db_model.anubis
-public define DB_Table mf_serial_table =
- db_table("mf_serial",
- db_model(
+public define HK_Table mf_serial_table =
+ hk_table("mf_serial",
+ hk_model(
[
- db_column("serial", char_field(30), []),
- db_column("mac", char_field(30), []),
- db_column("app_id", char_field(50), []),
- db_column("enabled", boolean_field, [], help_text("Is enabled?")),
- db_column("free_domain", boolean_field, [], help_text("Free domain available?")),
- db_column("max_domains", integer_field, [], help_text("Maximum number of domains")),
- db_column("is_demo", boolean_field, [], help_text("Is demo?")),
- db_column("is_test", boolean_field, [], help_text("Is test?")),
- db_column("date_created", datetime_field(auto_now_add), []),
- db_column("last_updated", datetime_field(none), []),
- db_column("last_ping", datetime_field(none), []),
- db_column("current_ip", char_field(20), []),
- db_column("mf_version", char_field(20), [], help_text("MF version")),
- db_column("vm_version", char_field(20), [], help_text_TAG("ANUBIS_VM_VER")),
- db_column("os_version", char_field(20), [], help_text("OS version")),
- db_column("ipkg_list", text_field, []),
- db_column("ifconfig", text_field, []),
- db_column("dmesg", text_field, []),
- db_column("memory", text_field, []),
- db_column("vm_memory", text_field, []),
- db_column("status", text_field, []),
- db_column("disks", text_field, []),
- db_column("isp_smtp", text_field, []),
- db_column("description", text_field, []),
- db_column("comments", text_field, []),
- db_column("alert_received", boolean_field, [], help_text("Alert received?")),
- db_column("alert_date", datetime_field(none), []),
- db_column("alert_msg", text_field, []),
- db_column("alert_mf_version", char_field(20), []),
+ 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"
),
@@ -55,13 +55,13 @@ public define DB_Table mf_serial_table =
)
).
-public define DB_Table settings_table =
- db_table("settings",
- db_model(
+public define HK_Table settings_table =
+ hk_table("settings",
+ hk_model(
[
- db_column("var_name", char_field(20), []),
- db_column("var_value", char_field(20), []),
+ hk_column("var_name", char_field(20), []),
+ hk_column("var_value", char_field(20), []),
],
"obj.var_name+\" = \"+obj.var_value"
),
@@ -73,20 +73,20 @@ public define DB_Table settings_table =
)
).
-public define DB_Table django_admin_log_table =
- db_table("django_admin_log",
- db_model(
+public define HK_Table django_admin_log_table =
+ hk_table("django_admin_log",
+ hk_model(
[
- db_column("action_time", datetime_field(auto_now_add), []),
-// db_column("user_id", foreign_key("auth_user"), [indexed]),
-// db_column("content_type_id", foreign_key("django_content_type"), [indexed]),
- db_column("user_id", integer_field, []),
- db_column("content_type_id", integer_field, []),
- db_column("object_id", text_field, []),
- db_column("object_repr", char_field(200), []),
- db_column("action_flag", integer_field, []),
- db_column("change_message", text_field, []),
+ 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"
),
@@ -98,14 +98,14 @@ public define DB_Table django_admin_log_table =
)
).
-public define DB_Table production_macaddress_table =
- db_table("production_macaddress",
- db_model(
+public define HK_Table production_macaddress_table =
+ hk_table("macaddress",
+ hk_model(
[
- db_column("mac", char_field(20), []),
- db_column("index", integer_field, []),
- db_column("mailfountain_id", integer_field, []),
+ hk_column("mac", char_field(20), []),
+ hk_column("index", integer_field, []),
+ hk_column("mailfountain_id", integer_field, []),
],
"obj.mac+\" = MailFountain[\"+obj.mailfountain_id+\"]\""
),
@@ -117,12 +117,12 @@ public define DB_Table production_macaddress_table =
)
).
-public define DB_Table production_mass_storage_type_table =
- db_table("production_mass_storage_type",
- db_model(
+public define HK_Table production_mass_storage_type_table =
+ hk_table("mass_storage_type",
+ hk_model(
[
- db_column("type", char_field(20), []),
+ hk_column("type", char_field(20), []),
],
"to_String(obj.id)+\":\"+obj.type"
),
@@ -136,18 +136,18 @@ public define DB_Table production_mass_storage_type_table =
-public define DB_Table production_mass_storage_table =
- db_table("production_mass_storage",
- db_model(
+public define HK_Table production_mass_storage_table =
+ hk_table("mass_storage",
+ hk_model(
[
- db_column("purchase_id", foreign_key("production_purchase"), [indexed]),
- db_column("model_id", foreign_key("production_mass_storage_model"), [indexed]),
- db_column("serial", char_field(40), []), //
- db_column("status", char_field(10), []), //
- db_column("date_created", datetime_field(auto_now_add), []),
- db_column("last_modified", datetime_field(auto_now), []),
- db_column("comments", text_field, []) // whatever the user wants to keep
+ 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"
),
@@ -175,18 +175,18 @@ public define DB_Table production_mass_storage_table =
-public define DB_Table production_mass_storage_model_table =
- db_table("production_mass_storage_model",
- db_model(
+public define HK_Table production_mass_storage_model_table =
+ hk_table("mass_storage_model",
+ hk_model(
[
- db_column("manufacturer", char_field(20), []),
- db_column("type_id", foreign_key("production_mass_storage_type"), [indexed]),
- db_column("capacity", integer_field, []), //
- db_column("tr_min", integer_field, []), //
- db_column("date_created", datetime_field(auto_now_add), []),
- db_column("last_modified", datetime_field(auto_now), []),
- db_column("comments", text_field, []) // whatever the user wants to keep
+ 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"
),
@@ -200,18 +200,18 @@ public define DB_Table production_mass_storage_model_table =
)
).
-public define DB_Table production_memory_table =
- db_table("production_memory",
- db_model(
+public define HK_Table production_memory_table =
+ hk_table("memory",
+ hk_model(
[
- db_column("purchase_id", foreign_key("production_purchase"), [indexed]),
- db_column("model_id", foreign_key("production_memory_model"), [indexed]),
- db_column("serial", char_field(40), []), //
- db_column("status", char_field(10), []), //
- db_column("date_created", datetime_field(auto_now_add), []),
- db_column("last_modified", datetime_field(auto_now), []),
- db_column("comments", text_field, []) // whatever the user wants to keep
+ 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"
),
@@ -225,14 +225,14 @@ public define DB_Table production_memory_table =
)
).
-public define DB_Table production_memory_model_table =
- db_table("production_memory_model",
- db_model(
+public define HK_Table production_memory_model_table =
+ hk_table("memory_model",
+ hk_model(
[
- db_column("type_id", foreign_key("production_memory_type"), [indexed]),
- db_column("manufacturer", char_field(20), []), //
- db_column("capacity", integer_field, []) //
+ hk_column("type_id", foreign_key("memory_type"), [indexed]),
+ hk_column("manufacturer", char_field(20), []), //
+ hk_column("capacity", integer_field, []) //
],
"obj.manufacturer"
),
@@ -244,12 +244,12 @@ public define DB_Table production_memory_model_table =
)
).
-public define DB_Table production_memory_type_table =
- db_table("production_memory_type",
- db_model(
+public define HK_Table production_memory_type_table =
+ hk_table("memory_type",
+ hk_model(
[
- db_column("type", char_field(20), []),
+ hk_column("type", char_field(20), []),
],
"to_String(obj.id)+\":\"+obj.type"
),
@@ -261,19 +261,19 @@ public define DB_Table production_memory_type_table =
)
).
-public define DB_Table production_motherboard_table =
- db_table("production_motherboard",
- db_model(
+public define HK_Table production_motherboard_table =
+ hk_table("motherboard",
+ hk_model(
[
- db_column("purchase_id", foreign_key("production_purchase"), [indexed]),
- db_column("model_id", foreign_key("production_motherboard_model"), [indexed]),
- db_column("serial", char_field(40), []), //
- db_column("week_fab", char_field(10), []), //
- db_column("status", char_field(10), []), //
- db_column("date_created", datetime_field(auto_now_add), []),
- db_column("last_modified", datetime_field(auto_now), []),
- db_column("comments", text_field, []) // whatever the user wants to keep
+ 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"
),
@@ -287,19 +287,19 @@ public define DB_Table production_motherboard_table =
)
).
-public define DB_Table production_motherboard_model_table =
- db_table("production_motherboard_model",
- db_model(
+public define HK_Table production_motherboard_model_table =
+ hk_table("motherboard_model",
+ hk_model(
[
- db_column("name", char_field(30), []),
- db_column("manufacturer", char_field(20), []),
- db_column("has_nand", boolean_field, []),
- db_column("nand_capacity", integer_field, []), //
- db_column("memory", integer_field, []), //
- db_column("cpu_freq", integer_field, []), //
- db_column("cpu_model", char_field(30), []),
- db_column("endian", char_field(1), []) // whatever the user wants to keep
+ 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"
),
@@ -313,18 +313,18 @@ public define DB_Table production_motherboard_model_table =
)
).
-public define DB_Table production_power_supply_table =
- db_table("production_power_supply",
- db_model(
+public define HK_Table production_power_supply_table =
+ hk_table("power_supply",
+ hk_model(
[
- db_column("purchase_id", foreign_key("production_purchase"), [indexed]),
- db_column("model_id", foreign_key("production_power_supply_model"), [indexed]),
- db_column("serial", char_field(40), []), //
- db_column("status", char_field(10), []), //
- db_column("date_created", datetime_field(auto_now_add), []),
- db_column("last_modified", datetime_field(auto_now), []),
- db_column("comments", text_field, []) // whatever the user wants to keep
+ 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"
),
@@ -338,14 +338,14 @@ public define DB_Table production_power_supply_table =
)
).
-public define DB_Table production_power_supply_model_table =
- db_table("production_power_supply_model",
- db_model(
+public define HK_Table production_power_supply_model_table =
+ hk_table("power_supply_model",
+ hk_model(
[
- db_column("name", char_field(30), []),
- db_column("manufacturer", char_field(20), []),
- db_column("power", integer_field, [])
+ hk_column("name", char_field(30), []),
+ hk_column("manufacturer", char_field(20), []),
+ hk_column("power", integer_field, [])
],
"obj.name"
),
@@ -359,23 +359,23 @@ public define DB_Table production_power_supply_model_table =
)
).
-public define DB_Table production_product_reference_table =
- db_table("production_product_reference",
- db_model(
+public define HK_Table production_product_reference_table =
+ hk_table("product_reference",
+ hk_model(
[
- db_column("type_ref_id", foreign_key("production_type_number"), [indexed]),
- db_column("product_ref", char_field(4), []),
- db_column("product_name", char_field(30), []), //
- db_column("description", char_field(200), []), //
- db_column("need_memory", boolean_field, []), //
- db_column("need_power_supply", boolean_field, []), //
- db_column("need_additional_storage", boolean_field, []), //
- db_column("min_additional_storage", integer_field, []), //
- db_column("max_additional_storage", integer_field, []), //
- db_column("date_created", datetime_field(auto_now_add), []),
- db_column("last_modified", datetime_field(auto_now), []),
- db_column("comments", text_field, []) // whatever the user wants to keep
+ 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"
),
@@ -390,29 +390,29 @@ public define DB_Table production_product_reference_table =
)
).
-public define DB_Table production_products_table =
- db_table("production_products",
- db_model(
+public define HK_Table production_products_table =
+ hk_table("products",
+ hk_model(
[
- db_column("production_id", foreign_key("production_production"), []),
- db_column("produced", boolean_field, []), //
- db_column("date", date_field(none), []),
- db_column("serial", char_field(50), []), //
- db_column("security_code", char_field(50), []), //
- db_column("motherboard_id", foreign_key("production_motherboard"), []),
- db_column("storage_id", foreign_key("production_mass_storage"), []),
- db_column("memory_id", foreign_key("production_memory"), []),
- db_column("power_supply_id", foreign_key("production_power_supply"), []),
- db_column("wifi", boolean_field, []), //
- db_column("mac", char_field(20), []),
- db_column("app_id", char_field(100), []),
- db_column("os_version", char_field(20), []),
- db_column("published", boolean_field, []),
- db_column("publish_date", datetime_field(none), []), //
- db_column("status", char_field(10), []),
- db_column("date_created", datetime_field(auto_now_add), []),
- db_column("last_modified", datetime_field(auto_now), []),
- db_column("comments", text_field, []) // whatever the user wants to keep
+ 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"
),
@@ -427,26 +427,26 @@ public define DB_Table production_products_table =
)
).
-public define DB_Table production_production_table =
- db_table("production_production",
- db_model(
+public define HK_Table production_production_table =
+ hk_table("production",
+ hk_model(
[
- db_column("date", date_field(none), []),
- db_column("assembler_id", foreign_key("staff_staff"), []),
- db_column("type_ref_id", foreign_key("production_type_number"), []),
- db_column("product_ref_id", foreign_key("production_product_reference"), []),
- db_column("site_id", foreign_key("production_production_site"), []),
- db_column("serial_prefix_id", foreign_key("production_serial_prefix"), []),
- db_column("sticker_tpl_id", foreign_key("production_type_number"), []),
- db_column("starting_index", integer_field, []), //
- db_column("product_count", integer_field, []), //
- db_column("produced_count", integer_field, []), //
- db_column("completed", boolean_field, []), //
- db_column("active", boolean_field, []), //
- db_column("date_created", datetime_field(auto_now_add), []),
- db_column("last_modified", datetime_field(auto_now), []),
- db_column("comments", text_field, []) // whatever the user wants to keep
+ 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)"
),
@@ -461,18 +461,18 @@ public define DB_Table production_production_table =
)
).
-public define DB_Table production_production_site_table =
- db_table("production_production_site",
- db_model(
+public define HK_Table production_production_site_table =
+ hk_table("production_site",
+ hk_model(
[
- db_column("ref", char_field(3), []),
- db_column("name", char_field(50), []),
- db_column("city", char_field(30), []),
- db_column("country", char_field(30), []),
- db_column("next_serial", integer_field, []),
- db_column("date_created", datetime_field(auto_now_add), []),
- db_column("last_modified", datetime_field(auto_now), []),
- db_column("comments", text_field, []) // whatever the user wants to keep
+ 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"
),
@@ -486,18 +486,18 @@ public define DB_Table production_production_site_table =
)
).
-public define DB_Table production_purchase_table =
- db_table("production_purchase",
- db_model(
+public define HK_Table production_purchase_table =
+ hk_table("purchase",
+ hk_model(
[
- db_column("date", date_field(none), []),
- db_column("buyer_id", foreign_key("staff_staff"), [indexed]),
- db_column("supplier_id", foreign_key("production_supplier"), [indexed]),
- db_column("order_ref", char_field(50), []), //
- db_column("description", char_field(200), []), // description of the purchase
- db_column("date_created", datetime_field(auto_now_add), []),
- db_column("last_modified", datetime_field(auto_now), []),
- db_column("comments", text_field, []), // whatever the user wants to keep
+ 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)"
),
@@ -511,13 +511,13 @@ public define DB_Table production_purchase_table =
)
).
-public define DB_Table production_serial_prefix_table =
- db_table("production_serial_prefix",
- db_model(
+public define HK_Table production_serial_prefix_table =
+ hk_table("serial_prefix",
+ hk_model(
[
- db_column("prefix", char_field(3), []),
- db_column("next_start", integer_field, [])
+ hk_column("prefix", char_field(3), []),
+ hk_column("next_start", integer_field, [])
],
"obj.prefix"
),
@@ -529,16 +529,16 @@ public define DB_Table production_serial_prefix_table =
)
).
-public define DB_Table production_type_number_table =
- db_table("production_type_number",
- db_model(
+public define HK_Table production_type_number_table =
+ hk_table("type_number",
+ hk_model(
[
- db_column("type_ref", char_field(3), []),
- db_column("description", text_field, []),
- db_column("date_created", datetime_field(auto_now_add), []),
- db_column("last_modified", datetime_field(auto_now), []),
- db_column("comments", text_field, []) // whatever the user wants to keep
+ 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"
),
@@ -552,28 +552,28 @@ public define DB_Table production_type_number_table =
)
).
-public define DB_Table production_supplier_table =
- db_table("production_supplier",
- db_model(
+public define HK_Table production_supplier_table =
+ hk_table("supplier",
+ hk_model(
[
- db_column("company", char_field(100), []),
- db_column("contact_id", foreign_key("address_book_contact"), []),
- db_column("address1", char_field(100), []),
- db_column("address2", char_field(100), []),
- db_column("zipcode", char_field(10), []),
- db_column("city", char_field(50), []),
- db_column("country", char_field(50), []),
- db_column("email", char_field(75), []),
- db_column("url", char_field(200), []),
- db_column("phone", char_field(20), []),
- db_column("fax", char_field(20), []),
- db_column("mobile", char_field(20), []),
- db_column("siret", char_field(50), []),
- db_column("tva_number", char_field(50), []),
- db_column("date_created", datetime_field(auto_now_add), []),
- db_column("last_modified", datetime_field(auto_now), []),
- db_column("comments", text_field, []) // whatever the user wants to keep
+ 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"
),
@@ -589,16 +589,16 @@ public define DB_Table production_supplier_table =
).
-public define DB_Table staff_department_table =
- db_table("staff_department",
- db_model(
+public define HK_Table department_table =
+ hk_table("department",
+ hk_model(
[
- db_column("name", char_field(50), []),
- db_column("description", text_field, []),
- db_column("date_created", datetime_field(auto_now_add), []),
- db_column("last_modified", datetime_field(auto_now), []),
- db_column("comments", text_field, []) // whatever the user wants to keep
+ 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"
),
@@ -613,15 +613,15 @@ public define DB_Table staff_department_table =
).
-public define DB_Table staff_role_table =
- db_table("staff_role",
- db_model(
+public define HK_Table role_table =
+ hk_table("role",
+ hk_model(
[
- db_column("role_name", char_field(50), []),
- db_column("description", text_field, []),
- db_column("date_created", datetime_field(auto_now_add), []),
- db_column("last_modified", datetime_field(auto_now), []),
- db_column("comments", text_field, []) // whatever the user wants to keep
+ 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"
),
@@ -635,21 +635,21 @@ public define DB_Table staff_role_table =
)
).
-public define DB_Table staff_staff_table =
- db_table("staff_staff",
- db_model(
+public define HK_Table staff_table =
+ hk_table("staff",
+ hk_model(
[
- db_column("contact_id", foreign_key("address_book_contact"), [indexed]),
- db_column("department_id", foreign_key("staff_department"), [indexed]),
- db_column("role_id", foreign_key("staff_role"), [indexed]),
- db_column("email", char_field(75), []),
- db_column("incoming_date", date_field(none), []), //
- db_column("outgoing_date", date_field(none), [], help_text("if not still present in company. The date of official outgoing")), //
- db_column("still_present", boolean_field, [], help_text("Still working for the company")),
- db_column("date_created", datetime_field(auto_now_add), []),
- db_column("last_modified", datetime_field(auto_now), []),
- db_column("comments", text_field, []) // whatever the user wants to keep
+ 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"
),
@@ -665,28 +665,28 @@ public define DB_Table staff_staff_table =
)
).
-public define DB_Table address_book_contact_table =
- db_table("address_book_contact",
- db_model(
+public define HK_Table address_book_contact_table =
+ hk_table("address_book_contact",
+ hk_model(
[
- db_column("first_name", char_field(50), []),
- db_column("last_name", char_field(50), []),
- db_column("company", char_field(100), []),
- db_column("role", char_field(50), []),
- db_column("address1", char_field(100), []),
- db_column("address2", char_field(100), []),
- db_column("zipcode", char_field(10), []),
- db_column("city", char_field(50), []),
- db_column("country", char_field(50), []),
- db_column("email", char_field(75), []),
- db_column("url", char_field(200), []),
- db_column("phone", char_field(20), []),
- db_column("fax", char_field(20), []),
- db_column("mobile", char_field(20), []),
- db_column("date_created", datetime_field(auto_now_add), []),
- db_column("last_modified", datetime_field(auto_now), []),
- db_column("comments", text_field, []) // whatever the user wants to keep
+ 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 "
),
@@ -702,36 +702,48 @@ public define DB_Table address_book_contact_table =
)
).
-public define DB_Database
+public define HK_Database
the_database_description
=
- db_database("prod_manager",
+ hk_database("prod_manager",
[
//domain manager
//mf_serial_table
- settings_table,
- 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,
- staff_department_table,
- staff_staff_table,
- staff_role_table,
- django_admin_log_table,
- address_book_contact_table
+ hk_app("base",
+ [
+ settings_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("",
+ [
+ django_admin_log_table,
+ address_book_contact_table
+ ])
]).
--
libgit2 0.21.4