Commit 01e6423e authored by Rafael De Lima Prado's avatar Rafael De Lima Prado
Browse files

database: Add version column


Signed-off-by: Rafael De Lima Prado's avatarRafael de Lima Prado <rlp09@inf.ufpr.br>
parent ff465bc0
......@@ -50,6 +50,7 @@ BEGIN
i.disk2_used,
i.extra_hds,
i.ts,
i.version,
'0'::boolean as valid
FROM
proinfo_inventory i
......@@ -181,6 +182,7 @@ BEGIN
disk1_model is NULL OR
disk1_size is NULL OR
disk1_used is NULL OR
version is NULL OR
NOT valid_macaddress(macaddr) OR
project < 0 OR project > 3 OR
inep is NULL);
......@@ -190,11 +192,11 @@ BEGIN
INSERT INTO rejected_inventory
(sch_id, cit_id, contact_date, project, inep, macaddr,
os_type, os_distro, os_kernel, processor, memory, disk1_model,
disk1_size, disk1_used, disk2_model, disk2_size, disk2_used, ts)
disk1_size, disk1_used, disk2_model, disk2_size, disk2_used, ts, version)
(SELECT
sch_id, cit_id, contact_date, project, inep, macaddr,
os_type, os_distro, os_kernel, processor, memory, disk1_model,
disk1_size, disk1_used, disk2_model, disk2_size, disk2_used, ts
disk1_size, disk1_used, disk2_model, disk2_size, disk2_used, ts, version
FROM
sa_inventory
WHERE
......
......@@ -15,10 +15,10 @@ BEGIN
INTO result from sa_inventory;
--
INSERT INTO fact_contact (sch_id, cit_id, dat_id, macaddr, project, ts)
(SELECT sch_id, cit_id, contact_date, macaddr::macaddr, to_project_enum(project), ts FROM sa_inventory WHERE valid = '1')
INSERT INTO fact_contact (sch_id, cit_id, dat_id, macaddr, project, ts, version)
(SELECT sch_id, cit_id, contact_date, macaddr::macaddr, to_project_enum(project), ts, version FROM sa_inventory WHERE valid = '1')
EXCEPT
(SELECT sch_id, cit_id, dat_id, macaddr, project, ts FROM fact_contact WHERE dat_id >= result.min_date AND dat_id <= result.max_date);
(SELECT sch_id, cit_id, dat_id, macaddr, project, ts, version FROM fact_contact WHERE dat_id >= result.min_date AND dat_id <= result.max_date);
-- how many rows were inserted?
GET DIAGNOSTICS total_rows = ROW_COUNT;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment