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.

Introspected CockroachDB schema has different field type than original Prisma schema that was migrated

See original GitHub issue

https://github.com/prisma/migrations-ci/commit/e30759d59b54d1aaf1f8bd7236a71b258c523b76 shows 2 schemas.diff where the type of a field is different different in the schema introspected from a databases that created based on a first introspected schema of the example database.

  1. https://github.com/prisma/migrations-ci/commit/e30759d59b54d1aaf1f8bd7236a71b258c523b76#diff-3cfebb6cd03f022a25275af8d5bf5a990572342af05d6515e994d3d21f620ce0 (results/cockroachdb-serverless/introspection-ci-5134.noalyss-folder/schemas.diff)
    ...
    190,195c190,195
    <   ex_enable Unsupported("char") @default(dbgenerated("'Y':::STRING::\"char\""))
    ---
    >   ex_enable String  @default(dbgenerated("'Y':::STRING::\"char\"")) @db.Char(1)
    225,226c225,226
    <   fi_debit     Unsupported("char") @default(dbgenerated("'d':::STRING::\"char\""))
    ---
    >   fi_debit     String        @default(dbgenerated("'d':::STRING::\"char\"")) @db.Char(1)
    
    Here we go from a Unsupported("char") to a String @db.Char(1) with an identical @default Original SQL is ex_enable "char" DEFAULT 'Y'::"char" NOT NULL.
  2. https://github.com/prisma/migrations-ci/commit/e30759d59b54d1aaf1f8bd7236a71b258c523b76#diff-fc00c6eeb3b064b49cdf3509d9dcbb78a5d3818ff28a72412b75e4da485ecc87 (results/cockroachdb-serverless/introspection-ci-5134.northwind/schemas.diff)
    20,21c20,21
    <   customer_id           String                @db.Char
    <   customer_type_id      String                @db.Char
    ---
    >   customer_id           String                @db.Char(1)
    >   customer_type_id      String                @db.Char(1)
    29c29
    <   customer_type_id       String                   @id(map: "pk_customer_demographics") @db.Char
    ---
    >   customer_type_id       String                   @id(map: "pk_customer_demographics") @db.Char(1)
    35c35
    <   customer_id            String                   @id(map: "pk_customers") @db.Char
    ---
    >   customer_id            String                   @id(map: "pk_customers") @db.Char(1)
    98c98
    <   customer_id      String?         @db.Char
    ---
    >   customer_id      String?         @db.Char(1)
    135c135
    <   region_description String        @db.Char
    ---
    >   region_description String        @db.Char(1)
    164c164
    <   territory_description String                 @db.Char
    ---
    >   territory_description String                 @db.Char(1)
    
    Here we fo from String @db.Char to String @db.Char(1). Original SQL seems to be territory_description bpchar NOT NULL, and similar.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
pimeyscommented, Mar 18, 2022

kekw, and then I find the bug from the code. When you come back on Monday @janpio do not read the two comments I wrote above.

0reactions
janpiocommented, Mar 31, 2022

Double checked, this is really fixed this time 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introspection | typescript-cockroachdb - Prisma
Introspection your database with Prisma. ... For the purpose of this guide, we'll use a demo SQL schema with three tables: CREATE TABLE...
Read more >
Prisma schema API (Reference)
API reference documentation for the Prisma Schema Language (PSL). ... String (URL), Connection URL to the shadow database used by Prisma Migrate.
Read more >
Data model (Reference) - Prisma
Generate the data model via introspection: When you have an existing database or prefer migrating your database schema with SQL, you generate the...
Read more >
Names in the underlying database - Prisma
The Prisma schema includes mechanisms that allow you to define names of certain database objects. You can: Map model and field names to...
Read more >
What is introspection? (Reference) - Prisma
Introspection has one main function: Populate your Prisma schema with a data ... using Prisma Migrate, but instead use plain SQL or another...
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