Is there a way to create a foreign key constraint using Persistent's schema syntax with the Postgres backend? Or do I need to do this manually with SQL? Specifically, an ON DELETE CASCADE relationship such that when a HackDay is deleted, all of its child Projects are deleted:
HackDay
title Text
created UTCTime default=now()
votingClosed Bool default=false
deriving Show
Project
hackday HackDayId
title Text
creators Text
votes Int default=0
created UTCTime default=now()
deriving Show
Persistent does not currently have any built-in support for triggers, though it's something we've been wanting to add (simply lacking manpower). For now, you'll have to add the trigger manually.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With