prisma-korea / graphql-schema-generator

Generate GraphQL Schema from Prisma schema.
MIT License
32 stars 12 forks source link

Add support for multiple @unique field #30

Closed yujonglee closed 2 years ago

yujonglee commented 2 years ago

Resolves #29.

@@unique and @@id have not yet been considered.

codecov-commenter commented 2 years ago

Codecov Report

Merging #30 (33c1983) into master (66aa2f4) will increase coverage by 0.03%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #30      +/-   ##
==========================================
+ Coverage   98.51%   98.55%   +0.03%     
==========================================
  Files          14       15       +1     
  Lines         202      207       +5     
  Branches       17       17              
==========================================
+ Hits          199      204       +5     
  Misses          3        3              
hyochan commented 2 years ago

Resolves #29.

@@unique and @@id have not yet been considered.

@yujong-lee By the way, thinking again, I think translating unique to ID is not a good idea. ID should be only one but unique can be many.

Actually, we can use ID with one unique field if id is not provided.

https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#model

yujonglee commented 2 years ago

@hyochan Yes. before #30, every @unique field is converted to ID if there aren't any @id in model. After #30, it is converted only if there are only one @unique and no @id.

I will consider @@unique and @@id in the later PR (#31).