我在Rails中有一个项目,我在用户表上使用了单表继承,为用户表创建了两个角色——1.临床医生和2.患者。模型描述如下
class患者<使用者has_many:临床医生has_many:临床医生,通过::clinician_paients结束
类临床医生<使用者has_many:临床医生has_many:患者,通过::clinician_paients结束
这里有另一张临床医生的桌子:-
类临床医生Patient<ActiveRecord::基本belongs_to:临床医生belongs_to:患者结束
我是Prisma的新手,我想使用STI和关系,比如使用Prisma在Node中使用Rails。我应该如何在棱镜模型中使用STI?
正如您在这里看到的,prisma还不支持表继承,但计划在未来提供支持。
在正式实现之前,您可以尝试一些垫片实现:
- https://github.com/smcelhinney/prisma-merge-schema
- https://github.com/amplication/prisma-schema-dsl