I would like to ask about how to handle this relationship. For better view I've tried to simplify and convert my situation into how I think StackOverflow question voting has (sorry if not :-)
I would like to add a constraint with
CASCADE DELETE rule however I don't know if it's possible for this case. Another option is to create an
ON DELETE trigger, so...
My question is:
What would you prefer,
CASCADE DELETE constraint rule (if it's possible here) or
ON DELETE trigger ?
Or would you create a DB model for this simple case (imagine StackOverflow's voting scheme) different way ?
Why am I asking:
I've read somewhere that
CASCADE DELETE constraint rules are internally nothing else than triggers and that some people here don't prefer the constraint rules at all. I know, quite vague question, but I would like to have my DB clean from a not existing relationship records.
The important thing:
I'm creating the application which should be able to run on the SQL Server as well as on MySQL database engines, but both should support all, the
CASCADE DELETE constraint rules as well as
ON DELETE triggers, I guess.