Deleting relationship info

A place for users and developers of the Xataface to discuss and receive support.

Deleting relationship info

Postby 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
cantlep
 
Posts: 172
Joined: Fri Mar 05, 2010 2:14 am

Re: Deleting relationship info

Postby 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
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 23 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved