Deleting relationship info

Archived from the Xataface Users forum.

cantlep — Tue Oct 16, 2012 2:09 pm

Hiya,

Sorry, this is probably a noddy question (again). I’ve not been working for Xataface for soooo long that what skillz I had are long gone Trying hard to pick it back up again. Anyhow, here’s my issue.

I have a table (lets say table1) with a relationship (1 to many) with another table (table2). In terms of adding stuff to it, that all works fine (using the grid widget). However, when I delete the entry from table1, the relationship data still remains in table2. How can I get it to delete the table1 data and the table2 data when in one go.

I’ve a feeling I’ve asked this before, but can’t seem to find the post.

Cheers

Paul


shannah — Tue Oct 16, 2012 2:33 pm

You can either do it with a foreign key constraint (ON DELETE CASCADE) in MySQL if you’re using InnoDB tables; or you could add an afterDelete() trigger in the delegate class of the parent table to perform your cleanup.

-Steve