反向外键约束 [英] Reverse foreign key constraint
问题描述
Vector3可以通过很多不同的字段在不同的表格中。
我正在寻找的行为是,每当引用Vector3 Id的另一个表中的条目被删除,引用的Vector3行也被删除。
如果我在其他引用Vector3 Id的表上放置一个外键,那么当一个Vector3条目被删除时,其他表中的条目将被删除。
是删除级联行为的反向,但与主键仍然是Vector3 ID。
我假设这个概念不存在,我的方式制定这个问题谷歌并没有提出任何事情。
我不认为它确实存在。您可以使用触发器来删除记录中的其他表格
In a Sqlite database, I have a table Vector3 where I store my vectors X, Y, Z.
Vector3 Ids can be referenced by a lot of different fields in different tables. The behavior I'm looking for, is that whenever an entry in another table referencing the Vector3 Id is deleted, the Vector3 row referenced is deleted too.
If I put a foreign key on the other tables referencing Vector3 Id, then when a Vector3 entry will be deleted the entry in the other table will be deleted.
What I want is the reverse on delete cascading behavior, but with the primary key still being the Vector3 Id.
I'm supposing this concept doesn't exist and the way I managed to formulate this question to google didn't bring up anything.
I don't think that it does exist. You could use a trigger though to clean up the other tables on deletion of a record
这篇关于反向外键约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!