1

I have a user's schema: name, age, etc...

A user signs up in production,

I then decide I'd also like to capture "email" and save it in the User's table.

but since the previous records didn't have the email rece, prisma will want me to reset database

is there any walk around to prevent this database reset when migrating in prisma.js

Mr Right
  • 21
  • 3
  • Does this answer your question? [Make a change to the database with Prisma.js without having to reset the whole thing](https://stackoverflow.com/questions/68105010/make-a-change-to-the-database-with-prisma-js-without-having-to-reset-the-whole-t) – myteardrop4u Feb 10 '23 at 21:54

1 Answers1

0

A workaround might be manually adding a new field into your database, then introspecting your database, meaning pulling database structure in your prisma schema. After adding the field in your table, run npx prisma db pull. This should update your Prisma schema file. You might also need to regenerate prisma client using npx prisma generate.

Please also look here and here

myteardrop4u
  • 31
  • 1
  • 1
  • 8