When db is updated how to get that alter into prisma?
Hello- I am new to prisma & wondering any good resources or tutorials about moving structure down from the database or up from the schema?
Also if the database is altered slightly such as adding a column to a table; how can we update our prisma in our app?
I understand that if we update the schema.prisma file with adding a column we can then run a "prisma migrate dev" & it will alter the db but how can we do the same but if there is an update in the DB & we want to update our code?
thanks in advance for any & all assistance
5 Replies
Hey @chriscatto 👋
If I understand correctly, you want to get the changes that are made directly to the database in your schema file, right?
Yes correct; thanks @Nurul (Prisma)
I was trying different things with a sample db and I ended up deleting the data but trying to understand the process better;
In this case you should consider using Introspection to ensure that all manual changes to the database are reflected correctly in the schema file
https://www.prisma.io/docs/orm/prisma-schema/introspection
What is introspection? (Reference) | Prisma Documentation
Learn how you can introspect your database to generate a data model into your Prisma schema.
thank you; very helpful documentation
I am glad to hear that 🙏