Join our community

Get access to the complete guide to developing and deploying fast, production-ready Nuxt apps.

6-3 Add LessonProgress Model to Our Schema

NOTE: Supabase has updated their setup instructions, which requires us to set up a shadow DB for migrations. Before continuing with this lesson, you’ll need to add the shadow DB as outlined in their instructions, then run prisma migrate reset.

In this lesson, we update our Prisma schema with a new model to store our lesson progress.

We add a LessonProgress model and link it to our Lesson object. This model only tracks if a specific user has completed a specific lesson or not.

We use the @@unique attribute to indicate that for each LessonProgress object, every pair of (user, lesson) is unique. This will be important in future lessons when we want to fetch and update these objects.

Prisma Attributes: https://www.prisma.io/docs/concepts/components/prisma-schema/data-model#defining-a-unique-field