[racktables-users] RE: [racktables-users] Re: [racktables-users] Deleting objects doesn´t delete corresponding attributes

  • From: Göran Törnqvist <Goran.Tornqvist@xxxxxxxxxx>
  • To: "racktables-users@xxxxxxxxxxxxx" <racktables-users@xxxxxxxxxxxxx>
  • Date: Thu, 17 Mar 2011 12:22:39 +0100

Hi,
No constraints or ON DELETE CASCADE.
I didn´t install racktables so not sure if it was done incorrectly or something.
Is there a sql script I can run to add the constraints needed?

Thanks ...

mysql> SHOW CREATE TABLE AttributeValue;
+----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table          | Create Table                                                 
                                                                                
                                                                                
                                                                                
                            |
+----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| AttributeValue | CREATE TABLE `AttributeValue` (
  `object_id` int(10) unsigned default NULL,
  `attr_id` int(10) unsigned default NULL,
  `string_value` char(128) default NULL,
  `uint_value` int(10) unsigned default NULL,
  `float_value` float default NULL,
  UNIQUE KEY `object_id` (`object_id`,`attr_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
+----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)


-----Original Message-----
From: racktables-users-bounce@xxxxxxxxxxxxx 
[mailto:racktables-users-bounce@xxxxxxxxxxxxx] On Behalf Of Denis Ovsienko
Sent: den 17 mars 2011 12:16
To: racktables-users@xxxxxxxxxxxxx
Subject: [racktables-users] Re: [racktables-users] Deleting objects doesn´t 
delete corresponding attributes

> Seems to me there´s a ON DELETE CASCADE option missing in the DB?

Could you check, that output of SHOW CREATE TABLE AttributeValue is as folows?

CREATE TABLE `AttributeValue` (
  `object_id` int(10) unsigned default NULL,
  `attr_id` int(10) unsigned default NULL,
  `string_value` char(128) default NULL,
  `uint_value` int(10) unsigned default NULL,
  `float_value` float default NULL,
  UNIQUE KEY `object_id` (`object_id`,`attr_id`),
  CONSTRAINT `AttributeValue-FK-object_id` FOREIGN KEY (`object_id`) REFERENCES 
`RackObject` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB;


-- 
 Denis Ovsienko


Other related posts:

  • » [racktables-users] RE: [racktables-users] Re: [racktables-users] Deleting objects doesn´t delete corresponding attributes - Göran Törnqvist