Roles Schema

πŸ‘¨β€πŸ’Ό Let's role-up our users.
...
Was that a bad dad joke?
Anyway...
Users have roles, roles have permissions, and permissions can be assigned to roles. So we are going to have the following relationships:
  • many-to-many: User has many roles, roles can be assigned to many users
  • many-to-many: Role has many permissions and permissions can be assigned to many roles
As a reminder, Prisma manages the many-to-many relational table for you, so you just create the models with the relationships and Prisma will take care of the rest.
🐨 Update the schema in
Then run the migration to create a migration file and apply it to the database:
npx prisma migrate dev --name roles

Please set the playground first

Loading "Roles Schema"
Loading "Roles Schema"

Access Denied

You must login or register for the workshop to view the diff.

Check out this video to see how the diff tab works.