question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Introspect in 2.11.0 changes all updatedAt properties' types to timestamptz and comments them out

See original GitHub issue

Bug description

Using the latest release, 2.11.0, introspect will change all updatedAt properties’ types to timestamptz and comment them out.

How to reproduce

Given a PostgreSQL table:

CREATE TABLE IF NOT EXISTS "contact" (
  "id" uuid NOT NULL DEFAULT uuid_generate_v4(),
  "updatedAt" timestamp(6) with time zone NOT NULL DEFAULT now(),
  PRIMARY KEY ("id")
);

Model prior to introspection:

model contact {
  id                 String              @id @default(dbgenerated())
  updatedAt          DateTime            @default(now()) @updatedAt

Model after introspection:

model contact {
  id                 String              @id @default(dbgenerated())
  // This type is currently not supported.
  // updatedAt       timestamptz         @default(dbgenerated())

Expected behavior

Expect introspect to not change the schema.

Environment & setup

  • OS: Windows
  • Database: PostgreSQL
  • Node.js version: 12.16.1
  • Prisma version: 2.11.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:12
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
TLaddcommented, Nov 11, 2020

Would it be possible to suppress the warnings with a flag and restore the old behavior? It’s reasonable to warn about the use of timestamptz if they lead to unexpected behavior but for apps that were working before it would be nice to have an upgrade path without having to migrate the database. I would expect a lot of people using postgres would be using timestamptz since their docs explicitly suggest it over timestamp.

3reactions
xiaoyu-tamucommented, Nov 13, 2020

Could we just keep the old behavior if user didn’t enable the nativeType preview feature?

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found