Skip to content

Commit

Permalink
Merge pull request #74 from lottamus/create-many-skip-duplicates
Browse files Browse the repository at this point in the history
fix: add missing "skipDuplicates" option to createMany input args
  • Loading branch information
omar-dulaimi committed May 19, 2023
2 parents 36fbcf6 + 66a0a82 commit 558c0a0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/transformer.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type {
ConnectorType,
DMMF as PrismaDMMF
DMMF as PrismaDMMF,
} from '@prisma/generator-helper';
import path from 'path';
import {
checkModelHasModelRelation,
findModelByName,
isMongodbRawOp
isMongodbRawOp,
} from './helpers';
import { isAggregateInputType } from './helpers/aggregate-helpers';
import { AggregateOperationSupport, TransformerParams } from './types';
Expand Down Expand Up @@ -555,7 +555,12 @@ export default class Transformer {
imports,
)}${this.generateExportSchemaStatement(
`${modelName}CreateMany`,
`z.object({ data: z.union([ ${modelName}CreateManyInputObjectSchema, z.array(${modelName}CreateManyInputObjectSchema) ]) })`,
`z.object({ data: z.union([ ${modelName}CreateManyInputObjectSchema, z.array(${modelName}CreateManyInputObjectSchema) ]), ${
Transformer.provider === 'mongodb' ||
Transformer.provider === 'sqlserver'
? ''
: 'skipDuplicates: z.boolean().optional()'
} })`,
)}`,
);
}
Expand Down

0 comments on commit 558c0a0

Please sign in to comment.