model.3.0.0.anubis
8.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
read types/db_model.anubis
public define DB_Table mf_serial_table =
db_table("mf_serial",
db_model(
[
db_column("id", p_key, []),
db_column("serial", char_field(30), []),
db_column("mac", char_field(30), []),
db_column("app_id", char_field(50), []),
db_column("enabled",boolean_field, []),
db_column("free_domain",boolean_field, []),
db_column("max_domains",integer_field, []),
db_column("is_demo",boolean_field, []),
db_column("is_test",boolean_field, []),
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), []),
db_column("vm_version", char_field(20), []),
db_column("os_version", char_field(20), []),
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, []),
db_column("alert_date", datetime_field(none), []),
db_column("alert_msg", text_field, []),
db_column("alert_mf_version", char_field(20), []),
],
"obj.serial"
),
db_display(
//list_view
["id", "serial", "mf_version", "mac", "app_id", "is_demo", "is_test", "last_updated", "last_ping", "mf_version", ],
//list edit
["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 DB_Table settings_table =
db_table("settings",
db_model(
[
db_column("id", p_key, []),
db_column("var_name", char_field(20), []),
db_column("var_value", char_field(20), []),
],
"obj.var_name+\" = \"+obj.var_value"
),
db_display(
//list_view
["id", "var_name", "var_value"],
//list edit
["var_name", "var_value"]
)
).
public define DB_Table django_admin_log_table =
db_table("django_admin_log",
db_model(
[
db_column("id", p_key, []),
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, []),
],
"obj.object_repr"
),
db_display(
//list_view
["id", "action_time", "user_id", "content_type_id", "object_id", "object_repr", "action_flag", "change_message" ],
//list edit
["action_time", "user_id", "content_type_id", "object_id", "object_repr", "action_flag", "change_message"]
)
).
public define DB_Table production_macaddress_table =
db_table("production_macaddress",
db_model(
[
db_column("id", p_key, []),
db_column("mac", char_field(20), []),
db_column("index", integer_field, []),
db_column("mailfountain_id", integer_field, []),
],
"obj.mac+\" = MailFountain[\"+obj.mailfountain_id+\"]\""
),
db_display(
//list_view
["id", "mac", "index", "mailfountain_id"],
//list edit
["mac", "index", "mailfountain_id"]
)
).
public define DB_Table production_memory_type_table =
db_table("production_memory_type",
db_model(
[
db_column("id", p_key, []),
db_column("type", char_field(20), []),
],
"to_String(obj.id)+\":\"+obj.type"
),
db_display(
//list_view
["id", "type"],
//list edit
["type"]
)
).
public define DB_Table production_mass_storage_type_table =
db_table("production_mass_storage_type",
db_model(
[
db_column("id", p_key, []),
db_column("type", char_field(20), []),
],
"to_String(obj.id)+\":\"+obj.type"
),
db_display(
//list_view
["id", "type"],
//list edit
["type"]
)
).
public define DB_Table production_mass_storage_model_table =
db_table("production_mass_storage_model",
db_model(
[
db_column("id", p_key, []),
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
],
"obj.manufacturer"
),
db_display(
//list_view
["id", "manufacturer", "type_id", "capacity", "tr_min", "last_modified", "date_created"],
//list_edit
[]
)
).
public define DB_Table production_mass_storage_table =
db_table("production_mass_storage",
db_model(
[
db_column("id", p_key, []),
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
],
"obj.purchase_id.string"
),
db_display(
//list_view
["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 DB_Table production_purchase_table =
db_table("production_purchase",
db_model(
[
db_column("id", p_key, []),
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
],
""
),
db_display(
//list_view
["date", "supplier_id", "description"],
//list_edit
["date", "buyer_id", "supplier_id", "order_ref", "description", "comments"]
)
).
public define DB_Database
the_database_description
=
db_database("prod_manager",
[
mf_serial_table
/*settings_table,
production_mass_storage_type_table,
production_mass_storage_model_table,
production_memory_type_table,
production_macaddress_table,
django_admin_log_table*/
//production_mass_storage_table,
//production_purchase_table
]).