Changes to schema.prisma
Whenever I want to push changes to a model in my schema.prisma, it asks me to delete all the available data first. Is there a way to get around this? What is the standard way of pushing up changes I make to my db?
2 Replies
Use prisma migrate to generate migration sql files that can be applied to the db without dataloss: https://www.prisma.io/docs/concepts/components/prisma-migrate
Prisma
Prisma Migrate | Database, Schema, SQL Migration Tool
Prisma Migrate is a database migration tool available via the Prisma CLI that integrates with Prisma schema for data modeling.
Or if you use planetscale, check out this video for best practices and db devleopment pipeline: https://www.youtube.com/watch?v=iaHt5_hg44c
Prisma
YouTube
Prisma & PlanetScale Best Practices
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).
Update ...