获取一张评论表来同时服务应用程序和帖子表?
我创建了一个名为 comments 的表,comments 有一个名为 ItemId 的属性,该属性用作其他两个表 posts 和 apps 的外键。
这是因为我希望评论表能够同时服务于应用程序和帖子表。但是,当尝试将值插入注释表时,它会引发外键约束错误。
有谁知道以最少的重复完成我想要做的事情的最佳方法?
I've created a table called comments, comments has a property called ItemId which is used as the foreign key for two other tables posts and apps.
This is because i was hoping for the comments table to serve both the apps and posts table. However when trying to insert a value into the comments table it throws a foreign key constraint error.
Does anyone know the best way of accomplishing what I'm trying to do with the least amount of duplication?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅此问题/答案。
See this question/answer.