Hi guys! I have a question about relations and del...
# orm-help
b
Hi guys! I have a question about relations and deletion: For example, I have 3 tables (Coupon, PromotionOwner, Promotion) Coupon and PromotionOwner implement "one-to-many" relation to Promotion(so one Coupon can have many Promotions, and one PromotionOwner can have many Promotions). I want that behave like this: when I delete PromotionOwner, all Promotions related to it would be deleted, but when I delete a Coupon, all Promotions related to it remain intact. I already had tables for these entities, but now I added such foreign keys: -- AddForeignKey ALTER TABLE "Promotion" ADD FOREIGN KEY ("couponId") REFERENCES "Coupon"("id") ON DELETE NO ACTION ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Promotion" ADD FOREIGN KEY ("promotionOwnerId") REFERENCES "PromotionOwner"("id") ON DELETE CASCADE ON UPDATE CASCADE; But still receive an Error like on the screenshot, If you know the root of the problem, please help me🙇