Ticket #1756 (closed defect: invalid)
Application level cascade and self-referencing relation
| Reported by: | mikovali | Owned by: | romanb |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.0.7 |
| Component: | Relations | Version: | 1.1.0-BETA1 |
| Severity: | Keywords: | delete cascade self-referencing relation | |
| Cc: | Has Test: | no | |
| Status: | Pending Core Response | Has Patch: | no |
Description
My schema:
Category:
columns:
title:
type: string(255)
notnull: true
parent_id:
type: integer
relations:
Children:
class: Category
local: id
foreign: parent_id
type: many
foreignAlias: Parent
foreignType: one
cascade: [delete]
But when deleting parent row that has children I get a constraint violation.
I'm not sure, but I think the problem is that the parent row is being deleted before the children (Or and once, because they are in the same table).
The query that failed was something like this:
DELETE FROM category WHERE id = 1 OR id = 2 ...
So I'm guessing there should be at least two queries (one for children and then one for parent).
(I've tried both 1.0 series and 1.1)
Sorry for not trying to write a patch or smth but really busy time before Christmas unfortunately.
Change History
Note: See
TracTickets for help on using
tickets.