⚠️ This lesson is retired and might contain outdated information.

Perform update operations using prisma client

Share this video with your friends

Social Share Links

Send Tweet
Published 4 years ago
Updated 2 years ago

In this lesson you will learn how to perform the update operations on postgres table entries using prisma client.

Dimitri Ivashchuk: [0:00] Now we want to update the user with some particular id. In this case, we are fetching the user with id 9, and the name is alex. We want to make it capital letter A. Let's try to do that. Comment this one for now.

[0:18] To do it with Prisma is quite simple. We do await prisma.users.update and then inside here, we need to pass where, where we specify concrete data rule that we want to modify. In this case, it would be the id 9 and as a second parameter, we need to pass the data.

[0:46] The name would be Alex. We save that, comment it out for now, and log the user. You see that the name is Alex now so our small query has worked correctly. Without commenting it out, we can change it straight ahead.

[1:12] You see that it changes to New user and basically, that would be it for doing the small updates for Prisma.

egghead
egghead
~ just now

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today