Matthias Klein wrote:
How can I implement something like ON DELETE CASCADE with Torque?
Like: let's say table BOOK references table AUTHOR through a relation WROTE.
Now let's say I have BOOK_ID 1 and AUTHOR_ID 1 and AUTHOR_ID 2 (because the
book was written by 2 authors).
Then I have the following WROTE:
BOOK_ID AUTHOR_ID
1 1
1 2
But now let's assume I wish to delete the book.
With SQL I simply create the table WROTE with ON DELETE CASCADE so once I
delete the book, the database also deletes all references (e.g. in WROTE)
How can I do that with Torque?
<foreign-key foreignTable="BOOK" onDelete="cascade">
<reference local="BOOK_ID" foreign="BOOK_ID"/>
</foreign-key>
I can't find it in the docs just now, but I am pretty certain "cascade"
is one of the values you can assign to the /onDelete/ attribute.
"setnull" is the other possible behaviour.
--
Regards/Gruß,
Tarlika Elisabeth Schmitz
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]