sal.tor
TTCTheo's Typesafe Cult
•Created by sal.tor on 3/5/2023 in #questions
Prisma: best way to structure these D&D schemas?
Context: I'm using tRPC, Prisma, and MongoDB
I have a few models like Campaign, Player, NPC, and Battle
Campaigns have many Player/NPC/Battle:
Battles are meant to have many Player and many NPC
But since there’s an order to battle I’m thinking I should create something like a
BattleParticipant
model which holds an order value and which entity it’s in regard to
Each participant can have an entityType (a string value) so i know whether it’s a Player or NPC, and entityId so I can properly refer to it
I'll post my desired outcome and alternative I've thought of in a comment8 replies