#AskPrisma I have read the doc where postgres supp...
# orm-help
i
#AskPrisma I have read the doc where postgres support table inheritance, now I dont know how do we do it in prisma schema??
r
@Ian 👋 Currently we do not support inheritance. It would be great if you could create a feature request for this here 🙂
i
Thanks, just a follow up question the brute force practice available right now to achieve this is to just add a discriminator in the table and laid out all the fields right?
r
Yup I think that’s the only way. One interesting feature request we already have that’s similar to what you want is here that you could have a look at.
Also adding a 👍 to this if it matches would be great!
i
Thanks for assisting. Im coming from mongoose and prisma makes me feels like Ill never look back. Thanks!!!
🙌 1
r
We are also creating a MongoDB adaptor (still in preview) but you can signup for that here 😄
💯 1
i
One last question haha Is there a guidance when to use auto inc vs cuid and uuid?? I mean when do you use is what .. Could be good if the docs had a rule of thumb about this
r
I don’t think that there’s any rule of thumb to this. UUID’s are generally preferable as they mask the no. of records that you have. Auto inc id’s if used usually give out that info.
i
In your personal pref what would you recommend to me?
Does prisma model schema have a toJson transform??
Or will it support this kind of stuff?
r
Any specific reason you need a
toJson
?
I would recommend UUID’s.
❤️ 1
i
We have a practice in orm like mongoose/typeorm/mikroorm where there is transform or toJson annotation like where you can mask the
ObjectId
so you dont return the object id of database instead hash by using
HashIds
package...
I know we can do map manually before returning the objects/data but that would be tedious unlike if automaticall transformed via Json.Stringify
Is there any consequences or bad stories of not masking the record numbers??
r
You can directly select fields like this.
🙌 1
Basically if you’re using
id's
better not send them to the client as it’s easy to figure out the number of requests going to your system, so DDOS attacks can be timed.
🙌 1