Quramy / prisma-fabbrica

Prisma generator to define model factory

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create models without persisting

ssukienn opened this issue · comments

Feature request

Would that be possible to conditionally resign from persistence and simulate best-effort models' response from a create related API?
In another words could we derive Account type from AccountCreateInput without persisting to Prisma

Really nice library!

Hi @ssukienn

I think it's difficult.
For example, if the Account model is defined as the following, we should simulate the autoincrement() function, which is provided by not Prisma client but RDB.

model Account {
  id  Int  @id @default(autoincrement())
}

Of course, we know autoincrement can be simulated using ++count .

However,

  • It's touch to simulate all functions available in schema
  • I want to keep prisma-fabbrica responsible to only build input data for create method.