InnoDB Cascade Rule that looks at 2 columns?
Posted
by Travis
on Stack Overflow
See other posts from Stack Overflow
or by Travis
Published on 2010-06-12T18:18:23Z
Indexed on
2010/06/12
18:22 UTC
Read the original article
Hit count: 274
I have the following mysql InnoDB tables...
TABLE foldersA (
ID
title
)
TABLE foldersB (
ID
title
)
TABLE records (
ID
folderID
folderType
title
)
folderID in table "records" can point to ID in either "foldersA" or "foldersB" depending on the value of folderType. (0 or 1).
I am wondering:
Is there a way to create a CASCADE rule such that the appropriate rows in table records are automatically deleted when a row in either foldersA or folderB is deleted?
Or in this situation, am I forced to have to delete the rows in table "records" programatically?
Thanks for you help!
© Stack Overflow or respective owner