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.

These id fields were enriched with `@default(cuid())` information taken from the previous Prisma schema

See original GitHub issue

Bug description

While in the process of upgrading from prisma 1.13, I usually run introspection after each step. so one warning kept showing even though I don’t think there’s a need for it, correct me please.

How to reproduce

I just run

npx prisma introspect
*** WARNING ***
These id fields were enriched with `@default(cuid())` information taken from the previous Prisma schema.
- Model "A", field: "id"
- Model "B", field: "id"
.
.
.etc

Expected behavior

I think it should not be shown given the schema has actually been enriched

Prisma information

model Item1 {
  id                  String                 @id @default(cuid()) @db.Char(30)
}

model Item2 {
  id                  String                 @id @default(cuid()) @db.Char(30)
}

Environment & setup

OS: Ubuntu 18 Database: MySQL 5.7 Node.js version: 14.15.1

Prisma version:
prisma               : 2.17.0
@prisma/client       : 2.17.0
Current platform     : debian-openssl-1.1.x
Query Engine         : query-engine 3c463ebd78b1d21d8fdacdd27899e280cf686223 (at node_modules/@prisma/engines/query-engine-debian-openssl-1.1.x)
Migration Engine     : migration-engine-cli 3c463ebd78b1d21d8fdacdd27899e280cf686223 (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core 3c463ebd78b1d21d8fdacdd27899e280cf686223 (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary        : prisma-fmt 3c463ebd78b1d21d8fdacdd27899e280cf686223 (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Studio               : 0.353.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
omar-dulaimicommented, Mar 3, 2021

@Jolg42 doing that I lost the following attributes from the schema:

@default(cuid())
@updatedAt

Also relation fields names have changed to their models names, like reporter changed to AbuseReporter camelcase.

It basically messes the whole schema up and I have to go through the 700 lines schema line by line to fix the issues.

So I have no choice but to undo the --force

1reaction
carlosbensantcommented, Feb 20, 2022

They mentioned something about using the @default(cuid()) and @updatedAt attributes here: https://www.prisma.io/docs/guides/upgrade-guides/upgrade-from-prisma-1/schema-incompatibilities-postgres#manually-add-the-updatedat-attribute-to-the-prisma-model

They’re well-known problems and are seen/provided as workarounds.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Schema Incompatibilities | PostgreSQL - Prisma
Prisma 1 auto-generates ID values as CUIDs for ID fields when they're ... As a workaround, you can manually add the @default(cuid()) attribute...
Read more >
Data model (Reference) - Prisma
Learn about the concepts for building your data model with Prisma: Models, scalar types, enums, attributes, functions, IDs, default values and more.
Read more >
Prisma schema API (Reference)
In most cases, you want your database to create the ID. To do this, annotate the ID field with the @default attribute and...
Read more >
Upgrading the Prisma layer to Prisma 2 | PostgreSQL
With Prisma 2, this information is now specified inside the Prisma schema via ... @default(cuid()) for your @id fields; @updatedAt for any fields...
Read more >
What is introspection? (Reference) - Prisma
Learn how you can introspect your database to generate a data model into your Prisma schema.
Read more >

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