Prisma let’s you define relationships to relate tables with each other.

1. Types of relationships

  1. One to One
  2. One to Many
  3. Many to One
  4. Many to Many

2. For the TODO app, there is a one to many relationship

notion image

3. Updating the prisma schema

notion image

4. Update the database and the prisma client

npx prisma migrate dev --name relationship
npx prisma generate

💡

Try exploring the prisma/migrations folder now. Do you see more migrations for the newly created realtiohsip?

notion image