You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mismatch between the DateTime types of Prisma and the ones of Postgres (timestamptz unsupported) #552
I experienced an issue with the date format after introspecting a Postgres database.
The SQL migration statements of the initial DB schema:
CREATETABLEIF NOT EXISTS "users" ("id"SERIAL , "username"VARCHAR(255) NOT NULL UNIQUE, "createdAt"TIMESTAMP WITH TIME ZONENOT NULL, "updatedAt"TIMESTAMP WITH TIME ZONENOT NULL, PRIMARY KEY ("id"));
CREATETABLEIF NOT EXISTS "tasks" ("id"SERIAL , "title"VARCHAR(255), "createdAt"TIMESTAMP WITH TIME ZONENOT NULL, "updatedAt"TIMESTAMP WITH TIME ZONENOT NULL, "userId"INTEGERREFERENCES"users" ("id") ON DELETE CASCADEONUPDATE CASCADE, PRIMARY KEY ("id"));
The resulting Prisma data model after introspection:
model Task {
id Int @id
createdAt DateTime @default(now())
title String?
updatedAt DateTime @updatedAt
userId User?
@@map("tasks")
}
model User {
id Int @id
createdAt DateTime @default(now())
tasks Task[]
updatedAt DateTime @updatedAt
username String @unique
@@map("users")
}
The Photon API call that caused the issue:
photon.users.findMany()
The error message:
(node:21575) UnhandledPromiseRejectionWarning: Error:
Invalid `const users = await photon.users.findMany()` invocation in /Users/daisyt/Documents/Code/migration_sequelize_photon/src/index.ts:11:38
7
8 const photon = new Photon()
9
10 app.get('/users', async (req,[object Object], res) => {
→ 11 const users = await photon.users.findMany(
Error querying the database: db error: FATAL: role "user" does not exist date=2019-09-13T15:45:14.949Z
at PhotonFetcher.<anonymous> (/Users/daisyt/Documents/Code/migration_sequelize_photon/node_modules/@generated/photon/index.js:46:27)
at Generator.throw (<anonymous>)
at rejected (/Users/daisyt/Documents/Code/migration_sequelize_photon/node_modules/@generated/photon/index.js:5:65)
(node:21575) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:21575) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I can confirm this. I think we currently don't support timestampz date fields. With [email protected], binary version: f984d2c958c73ecfc500dd44b7ed2e1081cc8588 the runtime throws the following error:
So this is related to supporting custom database types: #446
Marking this as a feature request like we have done for other similar issues.
changed the title [-]mismatch between the DateTime types of Prisma and the ones of Postgres[/-][+]mismatch between the DateTime types of Prisma and the ones of Postgres (timestamptz unsupported)[/+]on Feb 19, 2020
Activity
pantharshit00 commentedon Sep 15, 2019
I can confirm this. I think we currently don't support
timestampzdate fields. With[email protected], binary version: f984d2c958c73ecfc500dd44b7ed2e1081cc8588the runtime throws the following error:So this is related to supporting custom database types: #446
Marking this as a feature request like we have done for other similar issues.
[-]mismatch between the DateTime types of Prisma and the ones of Postgres[/-][+]mismatch between the DateTime types of Prisma and the ones of Postgres (timestamptz unsupported)[/+]janpio commentedon May 11, 2020
Replaced by #2417
fix(framework-components): replace cross-family test imports with syn…
fix(sql-contract): compose pack validator fragments additively for th…
fix(family-sql): scope the postgres-enum guard to actual postgres-enu…