Line 1... |
Line 1... |
1 |
/* this is only for upgrades */
|
1 |
/* this is only for upgrades */
|
- |
|
2 |
drop table if exists temp;
|
2 |
create or replace table temp as select * from attrib;
|
3 |
create table temp as select * from attrib;
|
3 |
/* end start upgrades */
|
4 |
/* end start upgrades */
|
4 |
|
5 |
|
- |
|
6 |
drop table if exists attrib;
|
5 |
create or replace table attrib (
|
7 |
create table attrib (
|
6 |
attrib_id int(10) unsigned NOT NULL auto_increment,
|
8 |
attrib_id int(10) unsigned NOT NULL auto_increment,
|
7 |
attrib_category_id int unsigned default 1 references attrib_category( attrib_category_id ),
|
9 |
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',
|
10 |
name varchar(64) not null unique COMMENT 'the visible displayed name',
|
9 |
added_date date not null COMMENT 'date record was added',
|
11 |
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',
|
12 |
multiples char(1) default null comment 'set to true if ultiple entries are allowed',
|
11 |
removed_date date default NULL COMMENT 'date record was deleted or supserceded',
|
13 |
removed_date date default NULL COMMENT 'date record was deleted or supserceded',
|
12 |
keyname varchar(32) comment 'used for sysinfo really needs to be separate table',
|
14 |
keyname varchar(32) comment 'used for sysinfo really needs to be separate table',
|
13 |
PRIMARY KEY (attrib_id)
|
15 |
PRIMARY KEY (attrib_id)
|
14 |
) comment 'attributes that can be applied to a device';
|
16 |
) comment 'attributes that can be applied to a device';
|
15 |
|
17 |
|
- |
|
18 |
drop table if exists attrib_category;
|
16 |
create or replace table attrib_category (
|
19 |
create table attrib_category (
|
17 |
attrib_category_id int unsigned not null auto_increment,
|
20 |
attrib_category_id int unsigned not null auto_increment,
|
18 |
name varchar(64),
|
21 |
name varchar(64),
|
19 |
added_date date not null comment 'When this category was added',
|
22 |
added_date date not null comment 'When this category was added',
|
20 |
primary key (attrib_category_id)
|
23 |
primary key (attrib_category_id)
|
21 |
) comment 'just allows us to categorize attributes';
|
24 |
) comment 'just allows us to categorize attributes';
|
22 |
|
25 |
|
- |
|
26 |
drop table if exists attrib_device;
|
23 |
CREATE or replace TABLE attrib_device (
|
27 |
CREATE TABLE attrib_device (
|
24 |
attrib_device_id int unsigned not null auto_increment,
|
28 |
attrib_device_id int unsigned not null auto_increment,
|
25 |
device_id int(10) unsigned NOT NULL REFERENCES device(device_id),
|
29 |
device_id int(10) unsigned NOT NULL REFERENCES device(device_id),
|
26 |
attrib_id int(10) unsigned NOT NULL REFERENCES attrib(attrib_id),
|
30 |
attrib_id int(10) unsigned NOT NULL REFERENCES attrib(attrib_id),
|
27 |
value text COMMENT 'The actual value of this attribute.',
|
31 |
value text COMMENT 'The actual value of this attribute.',
|
28 |
added_date date NOT NULL COMMENT 'date record was added',
|
32 |
added_date date NOT NULL COMMENT 'date record was added',
|