Hello,

after some problems with broken relationships I tried to use delete with
the cascade option.
I found two problems with cascade:
- if multiple relationships point to the same table, the delete is
  executed more often than necessary (once for each relationship)
  This is not really a problem since the additional deletes are just
  no-ops.
- It seems that the cascade is done only one level deep and this is
  really a problem. I have a table with a relationship to a second table
  and this second has a many to many relationship.
  If I do the cascade by hand everything works o.k: I delete the record
  from the second table and the mapping table is also cleaned up. But
  if I delete a record from the first table, only the records from the
  second table are deleted but not from the mapping table referenced
  from table two.
  The docs don't say that it will delete more than one level but the
  word 'cascade' seems to imply it.

A complete cascading delete would be a first step, what I would really
like for the future would be an additional parameter to relationships
where I can say what to do if a cascading delete is requested. Values
that come to mind for such a parameter would be
- 'follow' to go one level deeper (this is what I normally want, see
  above),
- 'nofollow' to not follow the relationship chain any deeper (current
  behaviour).
- 'nodelete' to not delete records of this relationship even with
  cascade switched on (would help with my first point above) and
- 'die' to die if there are related records for this relationship (rolls
  back the whole delete chain).
Most important of these would be 'follow' and 'die' e.g. to delete
everything but prevent the whole delete if there is a related invoice.

Or are there any other ways to secure integrity with delete (short of
database triggers as suggested in the docs)?

-Michael


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to