Prisma
Introduction
Prisma is a relatively new ORM for Node.js projects. Its main benefit over other similar projects is its ability to generate insanely good type definitions from a schema.
To edit the schema, open prisma/schema.prisma
. Documentation on editing the schema can be found here.
Schema
- The
prisma/
folder contains theschema.prisma
file, which declares all our database tables, and the relations between these objects. - There is also a folder of migrations (changes made to the database) which are similar to git commits - these are not really meant to be read though.
- When you or a team member makes changes to the Prisma schema (
schema.prisma
), to update your local database with the schema changes usepnpm prisma:migrate:dev
. - This will create a SQL migration file, which should be committed to version control.
- Note that the AWS instance will run
pnpm prisma:migrate:prod
on deployment.