Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow Prisma client v5 #166

Closed
Quramy opened this issue Jul 14, 2023 · 0 comments · Fixed by #167
Closed

Follow Prisma client v5 #166

Quramy opened this issue Jul 14, 2023 · 0 comments · Fixed by #167

Comments

@Quramy
Copy link
Owner

Quramy commented Jul 14, 2023

Problems to solve

Prisma.<Model>CreateInput in v4 is not assignable to Prisma.<Model>CreateInput in v5 because this change

For details, prisma-fabbrica generates enumerable field TypeScript code as the following:

model FieldTypePatternModel {
  enumerableInt   Int[]
}
/* generated type */
type FieldTypePatternModelFactoryDefineInput = {
    enumerableInt?: Prisma.FieldTypePatternModelCreateenumerableIntInput | Prisma.Enumerable<number>;
}

The type Prisma.FieldTypePatternModelCreateenumerableIntInput | Prisma.Enumerable<number> can be assigned Prisma.FieldTypePatternModelCreateInput["enumerableInt"] in Primsa client v4, but can not be assigned to the same field in Prisma client v5.

In Prisma v5, Prisma.FieldTypePatternModelCreateInput["enumerableInt"] is defined as Prisma.FieldTypePatternModelCreateenumerableIntInput | Array<number>.

Implementation plan

Change prisma-fabbrica's code generation as the following:

/* before */

type FieldTypePatternModelFactoryDefineInput = {
    enumerableInt?: Prisma.FieldTypePatternModelCreateenumerableIntInput | Prisma.Enumerable<number>;
}
/* after */

type FieldTypePatternModelFactoryDefineInput = {
    enumerableInt?: Prisma.FieldTypePatternModelCreateenumerableIntInput | Array<number>;
}

And this change should be published as major version up because this change can break codes of users of prisma-fabbrica.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant