如何在房间数据中链接删除
我有两个数据库或两个表ex:一个用于比赛的数据库,一个用于聊天JN事件部分中,请注意,将所有消息插入一个表中,意味着每个匹配的每个聊天都插入了同一表中 我的目标是当我删除一组比赛时,我需要自动删除与这些聊天的所有聊天
I have two data base or two tables ex:one for matches and one for chat jn event section in match note that the all messages is inserted in one table mean that every chat of every match is inserted in the same table
My target is when I delete a group of matches I need to automatically delete all chats of those match with
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以
) 如果不是exsits .... ),以便触发器已经存在,但忽略了创建)。
<代码>创建触发器( sqlite.org/lang_createtrigger.html“ rel =“ nofollow noreferrer”> https://sqlite.org/lang_createtrigger.html 有关触发器的更多信息。
对于外国钥匙,您可能希望参考 https://developer.android.com/reference /androidx/room/foreferkey
You could
Room doesn't support TRIGGERS via annotation so you would have to create the TRIGGER(s) via code, probably using a CallBack with either, or perhaps both the onCreate or onOpen methods/functions overridden (if in onOpen then you should use
CREATE TRIGGER IF NOT EXSITS ....
so that if the trigger already exists that it doesn't fail but ignores the creation).You may wish to refer to https://sqlite.org/lang_createtrigger.html for more information regarding Triggers.
For Foreign Keys you may wish to refer to https://developer.android.com/reference/androidx/room/ForeignKey