Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement scalar list defaults proposal in query engine and client #13321

Closed
Tracked by #13318
tomhoule opened this issue May 12, 2022 · 1 comment
Closed
Tracked by #13318

Implement scalar list defaults proposal in query engine and client #13321

tomhoule opened this issue May 12, 2022 · 1 comment
Assignees
Labels
team/client Issue for team Client. tech/engines/query engine Issue in the Query Engine tech/typescript Issue for tech TypeScript. topic: prisma4
Milestone

Comments

@tomhoule
Copy link
Contributor

tomhoule commented May 12, 2022

https://www.notion.so/prismaio/Proposal-Scalar-List-Defaults-94d0891a3355475999f10b270e2a311a

TL;DR we will allow @default(...) attributes on scalar list fields in PSL. The behaviour should match that of regular scalar defaults.

Models like the following are currently not valid, but they will become valid on connectors that support scalar lists (mongodb, cockroachdb, postgres):

model Pizza {
  id       BigInt   @id @default(autoincrement())
  toppings String[] @default(["cheese", "tomato sauce", "pineapple"])
}

On first approximation, the foreseeable client work to make this work is:

  • Make the query engine insert these defaults when no value for the field is provided for the user, for consistency with other scalar defaults.
  • Determine if this needs to be reflected in the client API. The PSL proposal says "The client will not need to change since it was already possible to not specify values for scalar lists or provide undefined when writing client requests.".
@tomhoule tomhoule added tech/typescript Issue for tech TypeScript. tech/engines/query engine Issue in the Query Engine kind/subtask labels May 12, 2022
@janpio janpio added the team/client Issue for team Client. label May 16, 2022
@tomhoule tomhoule removed their assignment Jun 1, 2022
@floelhoeffel floelhoeffel added this to the 4.0.x milestone Jun 3, 2022
@tomhoule
Copy link
Contributor Author

prisma/prisma-engines#2946 was merged — feel free to close this if you consider the feature done from the client / QE side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team/client Issue for team Client. tech/engines/query engine Issue in the Query Engine tech/typescript Issue for tech TypeScript. topic: prisma4
Projects
None yet
Development

No branches or pull requests

4 participants