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.

naming a model `Datasource` breaks generated return types

See original GitHub issue

Bug description

naming a model Datasource will conflict with the generated Prisma.Datasource type which I assume is related to the datasource block in the schema.prisma.

Query results of type Prisma.Datasource will only have url property.

How to reproduce

generate a Prisma Client that has a Datasource model.

model Datasource {
  id Int @id @default(autoincrement())
}

types generated incorrectly

image

Expected behavior

No response

Prisma information

model Datasource {
  id Int @id @default(autoincrement())
}

generated model type

/**
 * Model Datasource
 * 
 */
export type Datasource = {
  id: number
}

generated type further down in index.d.ts

export type Datasource = {
  url?: string
 }

Environment & setup

  • OS: confirmed on MacOS 12.3
  • Database: generated with Postgres provider
  • Node.js version: 17.7.1

Prisma Version

3.10

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
Jolg42commented, Mar 21, 2022

Note that it would be better to avoid the conflict and not add more entries to the denylist

1reaction
janpiocommented, Mar 15, 2022

That would be one solution, yes. But for now this issue just tracks the problem, and the Client team can look into if it is possible to remove this limitation and clash somehow. We did so in the past for some of the terms.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make changes to an existing data source in Power Pivot
If columns are named differently in the source and in the model, you can go back and forth between the two sets of...
Read more >
GraphQL schema basics
Your GraphQL server uses a schema to describe the shape of your available data. This schema defines a hierarchy of types with fields...
Read more >
Refresh breaks due to COLUMN NAME CHANGES? 3 ways to ...
A simple Power BI column name change in the data source can break a power query refresh. It can be really frustrating that...
Read more >
Connecting with DataSource Objects (The Java™ Tutorials ...
Any connection produced by the BasicDataSource object ds will be a connection to the database CUSTOMER_ACCOUNTS . Registering DataSource Object with Naming ......
Read more >
Replace Data Sources - Tableau Help
... new data source (or have a different name) are removed from the Data pane. ... the toolbar to revert the change and...
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