Line 5... |
Line 5... |
5 |
create or replace table attrib (
|
5 |
create or replace table attrib (
|
6 |
attrib_id int(10) unsigned NOT NULL auto_increment,
|
6 |
attrib_id int(10) unsigned NOT NULL auto_increment,
|
7 |
attrib_category_id int unsigned default 1 references attrib_category( attrib_category_id ),
|
7 |
attrib_category_id int unsigned default 1 references attrib_category( attrib_category_id ),
|
8 |
name varchar(64) not null unique COMMENT 'the visible displayed name',
|
8 |
name varchar(64) not null unique COMMENT 'the visible displayed name',
|
9 |
added_date date not null COMMENT 'date record was added',
|
9 |
added_date date not null COMMENT 'date record was added',
|
- |
|
10 |
multiples char(1) default null comment 'set to true if ultiple entries are allowed',
|
10 |
removed_date date default NULL COMMENT 'date record was deleted or supserceded',
|
11 |
removed_date date default NULL COMMENT 'date record was deleted or supserceded',
|
11 |
keyname varchar(32) comment 'used for sysinfo really needs to be separate table',
|
12 |
keyname varchar(32) comment 'used for sysinfo really needs to be separate table',
|
12 |
PRIMARY KEY (attrib_id)
|
13 |
PRIMARY KEY (attrib_id)
|
13 |
) comment 'attributes that can be applied to a device';
|
14 |
) comment 'attributes that can be applied to a device';
|
14 |
|
15 |
|
Line 62... |
Line 63... |
62 |
|
63 |
|
63 |
/* do this only for upgrades */
|
64 |
/* do this only for upgrades */
|
64 |
insert into attrib (attrib_id,name,added_date,removed_date,keyname) select * from temp;
|
65 |
insert into attrib (attrib_id,name,added_date,removed_date,keyname) select * from temp;
|
65 |
insert into attrib_device select device_attrib_id,device_id,attrib_id,value,added_date,removed_date from device_attrib;
|
66 |
insert into attrib_device select device_attrib_id,device_id,attrib_id,value,added_date,removed_date from device_attrib;
|
66 |
|
67 |
|
- |
|
68 |
update attrib set multiples = '1' where name in ( 'Alias','MAC Address','Mass Storage','Memory','Note' );
|
- |
|
69 |
|
67 |
drop table temp;
|
70 |
drop table temp;
|
68 |
drop table device_attrib;
|
71 |
drop table device_attrib;
|
- |
|
72 |
|
- |
|
73 |
update attrib set name = 'Memory Total' where name = 'Memory';
|
- |
|
74 |
update attrib set name = 'CPU Count' where name = 'Number of CPUs';
|
- |
|
75 |
update attrib set name = 'CPU Family' where name = 'CPU Type';
|
- |
|
76 |
update attrib set name = 'CPU Cores' where name = 'Cores per CPU';
|
- |
|
77 |
update attrib set name = 'CPU Version' where name = 'CPU SubType';
|
- |
|
78 |
|
- |
|
79 |
update attrib set name = 'Firmware Revision' where name = 'Boot ROM Version';
|
- |
|
80 |
update report set screen_report = null where name in ( 'Device Attributes', 'Device PCI' );
|
- |
|
81 |
|
- |
|
82 |
update attrib_device set attrib_id = 5 where attrib_id = 45;
|
- |
|
83 |
update attrib set name = 'CPU Manufacturer',multiples=null where attrib_id = 45;
|
- |
|
84 |
|
- |
|
85 |
update attrib_device
|
- |
|
86 |
set removed_date = now()
|
- |
|
87 |
where
|
- |
|
88 |
attrib_device_id in (
|
- |
|
89 |
select toremove
|
- |
|
90 |
from
|
- |
|
91 |
(select
|
- |
|
92 |
device_id,
|
- |
|
93 |
min(attrib_device_id) toremove,
|
- |
|
94 |
count(*)
|
- |
|
95 |
from
|
- |
|
96 |
attrib_device k
|
- |
|
97 |
where
|
- |
|
98 |
attrib_id = 5
|
- |
|
99 |
and removed_date is null
|
- |
|
100 |
group by device_id
|
- |
|
101 |
having count(*) > 1) as j
|
- |
|
102 |
);
|
- |
|
103 |
|
- |
|
104 |
|
69 |
/* end of only for upgrades section */
|
105 |
/* end of only for upgrades section */
|