prisma / prisma1

💾 Database Tools incl. ORM, Migrations and Admin UI (Postgres, MySQL & MongoDB) [deprecated]
https://v1.prisma.io/docs/
Apache License 2.0
16.54k stars 862 forks source link

`@default` doesn't work in "create" part of upsert #1593

Closed ForsakenHarmony closed 6 years ago

ForsakenHarmony commented 6 years ago

Current behavior If you use @default to add a default value to a field it works when you use create, but not when using upsert

Reproduction Add @default to a field and try to create with upsert, leaving out the field

Expected behavior? upsert should use default values

marktani commented 6 years ago

I'm not sure if I'd agree with the expected behaviour you propose. For now, the default value is only reflected in create mutations and I think that's how it should be.

ForsakenHarmony commented 6 years ago

Why should it not work in upsert?

huv1k commented 6 years ago

Yea, i was thinking same. But only for create part of upsert

marktani commented 6 years ago

Ah, yea I agree 🙂

ForsakenHarmony commented 6 years ago

Obviously just for the create part, doesn't make sense to reset to the default value everytime ig

do4gr commented 6 years ago

Thanks for reporting this @ForsakenHarmony. I was able to reproduce and fix this. I will close this issue once the fix is rolled out.