Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. The model desc. is below

class Patient < User 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

Here I have another table clinician_patients :-

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. How should I use STI in prisma models?

like image 326
user15748180 Avatar asked Oct 24 '25 14:10

user15748180


1 Answers

As you can see here prisma does not support table inheritance yet, but support is planned in the future.

There are some shim implementations you can try out until there is an official implementation:

  • https://github.com/smcelhinney/prisma-merge-schema
  • https://github.com/amplication/prisma-schema-dsl
like image 95
Johannes Klauß Avatar answered Oct 26 '25 05:10

Johannes Klauß



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!