goofygoober
Explore posts from serversPPrisma
•Created by goofygoober on 4/24/2024 in #help-and-questions
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.7 replies
TTCTheo's Typesafe Cult
•Created by goofygoober on 9/27/2023 in #questions
Prisma migration issue on vercel deployment
Hi Gang,
I'm facing a persistent migration issue with my prisma model in my PostgreSQL database hosted on Railway. Here's a breakdown of the situation:
My original prisma schema model was the following:
I removed some columns and added new ones on a feature branch
feat/edit-lender-fees
And quickly learnt that dropping columns with existing data had caused a few problems. After creating a migration file by running prisma migrate dev
I had warnings that were in the migration.sql (which i called 20230925134023_lender_product_fees) but i did not see initially
Issues:
Removing columns with data resulted in warnings upon running npx prisma migrate dev.
Deploying to Vercel produced an error while running the script
"production:build": "npx prisma generate && npx prisma migrate deploy && next build"
Persistent error:
Note again, this was all done on a feature branch feat/edit-lender-fees
So I've abandoned that branch for now and gone to branched off main
again to add some new feature. This new branch does have the before mentioned migration.sql file 20230925134023_lender_product_fees
but I am still getting issues when deploying in the "Building step" with the same problem mentioned above.
Would anyone know why a branch that has nothing to do with the schema changes still be affecting the deployment?2 replies
TTCTheo's Typesafe Cult
•Created by goofygoober on 6/27/2023 in #questions
Setting up unit tests with Jest and React Testing Library
1 replies