@id @unique on id error should be highlighted when creating schemas and db push should fail
See original GitHub issueBug description
I noticed Prisma doesn’t reject or complain for error "@unique": Fields that are marked as id should not have an additional"
until when the schema has been pushed to db then error would pop out in Prisma studio.
I think this can improved by letting developer know before hand!
How to reproduce
example:
model Payment {
paymentId String @id @unique
date DateTime @default(now())
amount Int
success Boolean @default(true)
order Order[]
}
with the schema, prisma db push is a success instead of failing because paymentId field has @id and @unique
Expected behavior
Prisma should report this error “@unique”: Fields that are marked as id should not have an additional" before prisma db push can be successful
Prisma information
Environment & setup
- OS: Mac OS
- Database: PostgreSQL
- Node.js version: v14.16.1
Prisma Version
prisma : 3.9.2
@prisma/client : 3.9.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Prisma seed, node says Unique constraint failed on the ...
In the Figures_table you have defined a unique constraint on manufactureID which would mean that each manufacture could only have one figure ...
Read more >Creating and managing schemas | Cloud Pub/Sub ...
In the Google Cloud console, go to the Pub/Sub schemas page. · Click Create schema. · In the Schema ID field, enter an...
Read more >Issues that makes DataGrip an odd tool I can't recommend as ...
This is a basic way a database tool should work with result set. ... but ID highlighted as unresolved and UNPIVOT highlighted as...
Read more >Transactions - Prisma
Creating a team and adding a user should be one atomic operation that succeeds or fails as a whole. To implement atomic writes...
Read more >dbt Guide - GitLab
These models will be written to a logically named schema in the prep database based on the data source type. For example: Zuora...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok…sorry, I’ve been away. I’m going to try to reproduce the error and share!
Fields that are marked as id should not have an additional @unique
is not part of our codebase anymore, so we can close this issue. You probably had different versions running locally in some way, which meant that Studio used an older validation than the rest of the tooling.