简体   繁体   English

Prisma 中是否支持单表 Inheritance?

[英]Is there is any support for Single Table Inheritance in Prisma?

I have one project in Rails where I used Single Table Inheritance on Users Table, by creating two roles for Users table - 1.Clinician and 2.Patient.我在 Rails 中有一个项目,我在用户表上使用单表 Inheritance,为用户表创建两个角色 - 1.Clinician 和 2.Patient。 The model desc. model 描述。 is below在下面

class Patient < User has_many:clinician_patients has_many:clinicians, through: :clinician_patients end class 患者 < 用户 has_many:clinician_patients has_many:clinicians, through: :clinician_patients end

class Clinician < User has_many:clinician_patients has_many:patients, through: :clinician_patients end class 临床医生 < 用户 has_many:clinician_patients has_many:patients, through: :clinician_patients end

Here I have another table clinician_patients:-在这里,我有另一个表临床医生_患者:-

class ClinicianPatient < ActiveRecord::Base belongs_to:clinician belongs_to:patient end class ClinicianPatient < ActiveRecord::Base belongs_to:clinician belongs_to:patient end

I am new to Prisma and I want to use STI and relationships like Rails in Node using Prisma.我是 Prisma 的新手,我想使用 STI 和使用 Prisma 的 Node 中的 Rails 等关系。 How should I use STI in prisma models?我应该如何在棱镜模型中使用 STI?

As you can see here prisma does not support table inheritance yet, but support is planned in the future.正如您在此处看到的,prisma 尚不支持表 inheritance,但计划在未来提供支持。

There are some shim implementations you can try out until there is an official implementation:在正式实现之前,您可以尝试一些 shim 实现:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM