Skip to content

Prisma migrate incorrectly infers new migration needed when dbgenerated contains a string. #14917

@AndrewSouthpaw

Description

@AndrewSouthpaw

Bug description

Giving a default db generated value with a string in it leads Prisma Migrate to think a new migration is always needed:

datasource db {
  provider = "cockroachdb"
  // ...
}

model Test {
  id BigInt @id @default(autoincrement())
  foo Int
  bar String @default(dbgenerated("'hello world'"))
}

How to reproduce

  1. Use the schema above
  2. Create new migration
  3. Run prisma migrate dev again
  4. See Prisma prompt for a new migration 🐞

Expected behavior

Prisma doesn't prompt to create a new migration after the first one is created.

Prisma information

See above

Environment & setup

  • OS: macOS 12.4
  • Database: Cockroach v22.1.5
  • Node.js version: 14.17.6

Prisma Version

prisma                  : 4.2.1
@prisma/client          : 4.2.1
Current platform        : darwin
Query Engine (Node-API) : libquery-engine 2920a97877e12e055c1333079b8d19cee7f33826 (at node_modules/@prisma/engines/libquery_engine-darwin.dylib.node)
Migration Engine        : migration-engine-cli 2920a97877e12e055c1333079b8d19cee7f33826 (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine    : introspection-core 2920a97877e12e055c1333079b8d19cee7f33826 (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary           : prisma-fmt 2920a97877e12e055c1333079b8d19cee7f33826 (at node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash    : 2920a97877e12e055c1333079b8d19cee7f33826
Studio                  : 0.469.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.topic: dbgenerated

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions