Skip to content

Commit

Permalink
working on extendedWhereUniqueInput
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishoermann committed Mar 7, 2023
1 parent 0a61621 commit c8cdfe2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions packages/generator/src/classes/extendedDMMFInputType.ts
Expand Up @@ -56,6 +56,10 @@ export class ExtendedDMMFInputType
this.isDecimalField = this._setIsDecimalField();
this.omitFields = this._setOmitFields();
this.imports = this._setImports();

if (this.name === 'ProfileWhereUniqueInput') {
console.log(type);
}
}

/**
Expand All @@ -76,6 +80,12 @@ export class ExtendedDMMFInputType
(modelField) => modelField.name === field.name,
);

const hasConstraints = this.constraints.fields?.includes(field.name);

if (this.name === 'ProfileWhereUniqueInput') {
console.log({ fieldname: field.name, hasConstraints });
}

// validators and omitField should only be written for create and update types.
// this prevents validation in e.g. search queries in "where inputs",
// where strings like email addresses can be incomplete.
Expand Down
3 changes: 2 additions & 1 deletion packages/usage/prisma/schema.prisma
Expand Up @@ -4,7 +4,8 @@
generator client {
provider = "prisma-client-js"
// output = "./generated/client"
previewFeatures = ["views"]
previewFeatures = ["views", "extendedWhereUnique"]
// previewFeatures = ["views"]
}

datasource db {
Expand Down

0 comments on commit c8cdfe2

Please sign in to comment.