*Prisma &amp; PlanetScale Best Practices* <https:/...
# orm-help
u
Prisma & PlanetScale Best Practices

https://www.youtube.com/watch?v=iaHt5_hg44c

In this video, you will learn about everything you need to know when using Prisma with PlanetScale. We'll dive into: - Referential integrity and operating without foreign key constraints - Migration workflows with Prisma and PlanetScale using the
prisma db push
command - Defining indices on relation scalars (the foreign key fields). Timestamps: 00:00 Intro 00:41 The three best practices 03:34 Enabling and setting
referentialIntegrity
in the Prisma schema 04:59 Creating the PlanetScale database 05:44 Branching in PlanetScale 08:54 Creating a PlanetScale connection string 09:11 Creating the database schema with
prisma db push
09:37 Seeding the database with some data 10:04 Updating the Prisma schema and using native types to change the column type from VARCHAR to Text 11:54 Checking the data with Prisma Studio 12:37 Defining indices on relation scalars (the foreign key fields). 15:00 PlanetScale branching workflows 15:45 Promoting the main branch to production on PlanetScale 16:12 Creating a new branch to add more columns to the schema 18:05 Connecting to the
add-created-at
branch with the pscale connect command 19:08 Updating the DATABASE_URL env var in the .env file 20:12 Evolving the Prisma schema by adding more fields to the models 21:10 Running
prisma db push
to update the database schema of the branch 22:20 Creating a deploy request for the schema on PlanetScale 23:39 Deploying the deploy request 24:33 Recapping the branching workflow with a diagram 25:02 Tips for using Prisma and PlanetScale with Vercel 31:29 Summary