prisma / prisma-test-utils

A collection of data model agnostic test utils.
114 stars 11 forks source link

"Out of range value for column \'actor_user\' at row 1" #22

Open janpio opened 4 years ago

janpio commented 4 years ago

When using prisma-test-utils via prisma-test-utils-automation, some databases (schemas from: https://github.com/prisma/database-schema-examples) fail with this error message:

Error in: wikimedia
PrismaClientUnknownRequestError:
Invalid `: new actorClient()` invocation in
C:\Users\Jan\Documents\prisma-test-utils-automation\dbs\wikimedia\node_modules\prisma-client\index.js:1110:7

  1106   args || {},
  1107   [],
  1108   errorFormat,
  1109   measurePerformance
→ 1110 ) : new actorClient

Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Server(ServerError { code: 1264, message: "Out of range value for column \'actor_user\' at row 1", state: "22003" })) })
    at PrismaClientFetcher.request (C:\Users\Jan\Documents\prisma-test-utils-automation\dbs\wikimedia\node_modules\prisma-client\index.js:90:17)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
CREATE TABLE /*_*/actor (
  -- Unique ID to identify each actor
  actor_id bigint unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,

  -- Key to user.user_id, or NULL for anonymous edits.
  actor_user int unsigned,

  -- Text username or IP address
  actor_name varchar(255) binary NOT NULL
) /*$wgDBTableOptions*/;
model actor {
  actor_id   Int    @default(autoincrement()) @id
  actor_name String @unique
  actor_user Int?   @unique
}

Error message unfortunately does not mention what exactly it tried to insert, but it obv. did not fit the column. Maybe a negative number that clashed with the unsigned?

janpio commented 4 years ago
prisma-client   'mutation {\n' +
  prisma-client     '  createOneactor(data: {\n' +
  prisma-client     '    actor_name: "ofosid"\n' +
  prisma-client     '    actor_user: -232646535\n' +
  prisma-client     '  }) {\n' +
  prisma-client     '    actor_id\n' +
  prisma-client     '    actor_name\n' +
  prisma-client     '    actor_user\n' +
  prisma-client     '  }\n' +
  prisma-client     '}'

So indeed the unsigned is the problem.