CREATETABLE`component`(`id`int(11)unsignedNOTNULLAUTO_INCREMENTCOMMENT'ID for each component, unique index',`device_id`int(11)unsignedNOTNULLCOMMENT'device_id from the devices table',`type`varchar(50)COLLATEutf8_unicode_ciNOTNULLCOMMENT'name from the component_type table',`label`varchar(255)COLLATEutf8_unicode_ciDEFAULTNULLCOMMENT'Display label for the component',`status`tinyint(1)NOTNULLDEFAULT'1'COMMENT'The status of the component, retreived from the device',`disabled`tinyint(1)NOTNULLDEFAULT'0'COMMENT'Should this component be polled',`ignore`tinyint(1)NOTNULLDEFAULT'0'COMMENT'Should this component be alerted on',`error`varchar(255)COLLATEutf8_unicode_ciDEFAULTNULLCOMMENT'Error message if in Alert state',PRIMARYKEY(`id`),KEY`device`(`device_id`),KEY`type`(`type`))ENGINE=InnoDBAUTO_INCREMENT=0DEFAULTCHARSET=utf8COLLATE=utf8_unicode_ciCOMMENT='components attached to a device.';
DROPTABLEIFEXISTS`component_prefs`;
CREATETABLE`component_prefs`(`id`int(11)unsignedNOTNULLAUTO_INCREMENTCOMMENT'ID for each entry',`component`int(11)unsignedNOTNULLCOMMENT'id from the component table',`attribute`varchar(255)COLLATEutf8_unicode_ciNOTNULLCOMMENT'Attribute for the Component',`value`varchar(255)COLLATEutf8_unicode_ciNOTNULLCOMMENT'Value for the Component',PRIMARYKEY(`id`),KEY`component`(`component`),CONSTRAINT`component_prefs_ibfk_1`FOREIGNKEY(`component`)REFERENCES`component`(`id`)ONDELETECASCADEONUPDATECASCADE)ENGINE=InnoDBAUTO_INCREMENT=0DEFAULTCHARSET=utf8COLLATE=utf8_unicode_ciCOMMENT='AV Pairs for each component';