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

Composite Unique breaking Name Assertion #141

Closed
willwillis opened this issue Oct 26, 2020 · 0 comments
Closed

Composite Unique breaking Name Assertion #141

willwillis opened this issue Oct 26, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@willwillis
Copy link

This model is the result of prisma introspection

model JobRun {
  createdAt DateTime  @default(now())
  endTime   DateTime?
  exitCode  Int?
  id        Int       @default(autoincrement()) @id
  jobId     Int
  jobRunId  Int?
  moreInfo  String?
  startTime DateTime
  status    JobStatus @default(ACTIVATED)
  updatedAt DateTime
  Job       Job       @relation(fields: [jobId], references: [id])

  @@unique([jobId, startTime], name: "JobRun.jobId_startTime")
}

yarn generate fails with this error:

$ ts-node --transpile-only -P nexus.tsconfig.json src/Api/nexusSchema

/home/will/code/pal/paljs-fullstack-demo/node_modules/graphql/utilities/assertValidName.js:42
    return new _GraphQLError.GraphQLError("Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but \"".concat(name, "\" does not."), node);
           ^
GraphQLError: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "JobRun.jobId_startTimeCompoundUniqueInput" does not.
    at isValidNameError (/home/will/code/pal/paljs-fullstack-demo/node_modules/graphql/utilities/assertValidName.js:42:12)
    at Object.assertValidName (/home/will/code/pal/paljs-fullstack-demo/node_modules/graphql/utilities/assertValidName.js:21:15)
    at new NexusInputObjectTypeDef (/home/will/code/pal/paljs-fullstack-demo/node_modules/@nexus/schema/src/definitions/inputObjectType.ts:30:5)
    at Object.inputObjectType (/home/will/code/pal/paljs-fullstack-demo/node_modules/@nexus/schema/src/definitions/inputObjectType.ts:47:10)
    at forEach (/home/will/code/pal/paljs-fullstack-demo/node_modules/@paljs/nexus/src/index.ts:67:13)
    at Array.forEach (<anonymous>)
    at Object.onInstall (/home/will/code/pal/paljs-fullstack-demo/node_modules/@paljs/nexus/src/index.ts:64:23)
    at /home/will/code/pal/paljs-fullstack-demo/node_modules/@nexus/schema/src/builder.ts:657:44
    at Array.forEach (<anonymous>)
    at SchemaBuilder.beforeWalkTypes (/home/will/code/pal/paljs-fullstack-demo/node_modules/@nexus/schema/src/builder.ts:651:18)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Any ideas how to get around this issue?

Environment details:

@prisma/cli          : 2.9.0
@prisma/client       : 2.9.0
Current platform     : debian-openssl-1.1.x
Query Engine         : query-engine 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules/@prisma/cli/query-engine-debian-openssl-1.1.x)
Migration Engine     : migration-engine-cli 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules/@prisma/cli/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules/@prisma/cli/introspection-engine-debian-openssl-1.1.x)
Format Binary        : prisma-fmt 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules/@prisma/cli/prisma-fmt-debian-openssl-1.1.x)
Studio               : 0.296.0
``

@paljs/cli/2.5.2 linux-x64 node-v14.12.0


Thank you.
@AhmedElywa AhmedElywa self-assigned this Oct 28, 2020
@AhmedElywa AhmedElywa added the bug Something isn't working label Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants