DEV Community

Discussion on: It's Prisma Time - Migrations

Collapse
 
syzible profile image
Ed

How would you about splitting a column into two that involves some business logic? For example, "name" being split into "first_name" and "family_name" where you split the value "name" by the first instance of a space. Prisma looks great aside from this caveat

Collapse
 
puppo profile image
Luca Del Puppo

I feel like this problem is not a problem just for Prisma. The logic for splitting cannot be perfect in every solution. Probably, in this situation, the issue is the wrong choice of using only a column for the name during the table’s creation. Anyway, I think if you have this problem, you need to split the name using the first space and after that, or you check all the rows or you leave the columns in this way and, you know that the old rows probably can be wrong.