Best practices for updating column type when there are existing records
I'm seeking some guidance on updating a column type when there are existing records in my database. Here's the scenario:
Original Model:
New Model:
As you can see, I'm transitioning the posts field from an array of strings to a single integer. However, I'm unsure about the best approach for handling this change when there is existing records with the
String[]
type.
If anyone has links, videos or documentation to share on this, would be greatly appreciated.4 Replies
you'd have to push the schema everytime
Relations (Reference) | Prisma Documentation
A relation is a connection between two models in the Prisma schema. This page explains how you can define one-to-one, one-to-many and many-to-many relations in Prisma.
this is what you want to do, relations
@goofygoober
no that's not what i'm looking for @alessandroooo
I'm looking the change the field
posts
to have a type of Int
from type String[]
But my query is around, what are the best practices when there are existing records/entries in the database for posts
with the old String[]
type