prisma / prisma-client-js

Type-safe database client for TypeScript & Node.js (ORM replacement)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PANIC: called `Result::unwrap()` on an `Err` value: Could not parse stored DateTime string: 2020-12-09 05:49:44 (input contains invalid characters)

jasagiri opened this issue · comments

Hi Prisma Team! My Prisma Client just crashed. This is the report:

I tried to prisma's site article "Set up Prisma in Getting Started".
different from document is use sqlite3 database on windows 10.

What happens is "Write data into the database" section.
use command "npx ts-node index.ts"

created record User and Profile tables.
but Post table is empty.

probably datetime type in sqlite3 is text.
but convert numeric.

schema.sql

CREATE TABLE "User" (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
name VARCHAR(255),
email VARCHAR(255) UNIQUE NOT NULL
);
CREATE TABLE "Post" (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
title VARCHAR(255) NOT NULL,
"createdAt" TEXT NOT NULL DEFAULT (datetime(current_timestamp,'localtime')),
content TEXT,
published BOOLEAN NOT NULL DEFAULT false,
"authorId" INTEGER NOT NULL,
FOREIGN KEY ("authorId") REFERENCES "User"(id)
);
CREATE TABLE "Profile" (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
bio TEXT,
"userId" INTEGER UNIQUE NOT NULL,
FOREIGN KEY ("userId") REFERENCES "User"(id)
);

Versions

Name Version
Node v15.3.0
OS windows
Prisma Client 2.12.1

Logs

  prisma-client { clientVersion: '2.12.1' }  

0 verbose cli [
0 verbose cli 'C:\tools\nodejs\node.exe',
0 verbose cli 'C:\tools\nvm-noinstall\v15.3.0\node_modules\npm\bin\npm-cli.js',
0 verbose cli 'exec',
0 verbose cli '--',
0 verbose cli 'ts-node',
0 verbose cli 'src/index.ts'
0 verbose cli ]
1 info using npm@7.0.15
2 info using node@v15.3.0
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:C:\tools\nvm-noinstall\v15.3.0\node_modules\npm\npmrc Completed in 1ms
5 timing config:load:builtin Completed in 1ms
6 timing config:load:cli Completed in 1ms
7 timing config:load:env Completed in 0ms
8 timing config:load:file:C:\src\prisma-sample-scratch\hello-prisma.npmrc Completed in 0ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:C:\Users\hikar.npmrc Completed in 1ms
11 timing config:load:user Completed in 1ms
12 timing config:load:file:C:\tools\nodejs\etc\npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 7ms
19 verbose npm-session fb07340edd99be1c
20 timing npm:load Completed in 19ms
21 timing command:exec Completed in 1859ms
22 verbose stack Error: command failed
22 verbose stack at ChildProcess. (C:\tools\nvm-noinstall\v15.3.0\node_modules\npm\node_modules@npmcli\promise-spawn\index.js:64:27)
22 verbose stack at ChildProcess.emit (node:events:376:20)
22 verbose stack at maybeClose (node:internal/child_process:1055:16)
22 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:288:5)
23 verbose pkgid hello-prisma@1.0.0
24 verbose cwd C:\src\prisma-sample-scratch\hello-prisma
25 verbose Windows_NT 10.0.18363
26 verbose argv "C:\tools\nodejs\node.exe" "C:\tools\nvm-noinstall\v15.3.0\node_modules\npm\bin\npm-cli.js" "exec" "--" "ts-node" "src/index.ts"
27 verbose node v15.3.0
28 verbose npm v7.0.15
29 error code 1
30 error path C:\src\prisma-sample-scratch\hello-prisma
31 error command failed
32 error command C:\WINDOWS\system32\cmd.exe /d /s /c ts-node src\index.ts
33 verbose exit 1

Duplicate #873