Repository navigation
Migrating a db with faulty relation definitions #6700
|
Hey there, relative newcomer to Prisma. I have an existing database with 20+ tables that I want to use with Prisma. When generating the schema, it turns out there are a number of errors in the relation fields. For example: These are easily fixed by adjusting the type in the schema from However, should I now save the adjusted, now validating schema and then create an initial migration? That means the initial migration is already assuming the db was adjusted when thats not really the case yet. If I don't adjust the schema and try to create an initial migration, then the schema wont validate and I can't create an initial migration. Kind of at a loss for the way forward here. Appreciate any help. |
Replies: 2 comments 3 replies
|
Hm, interesting case. I do not think we have documentation for that yet - and also honestly no good answer to your question yet how to achieve this with Prisma. A workaround that would certainly work is to adapt your original database schema manually, and then run |
|
Hi there, To keep our discussions organized and focused on the most relevant topics, we’re reviewing and tidying up our backlog. As part of this process, we’re closing discussions that have already been marked as answered but remain open. If this discussion still requires further input or clarification, feel free to reopen it or start a new one with updated details. Your contributions are invaluable to the community, and we’re here to help! For more details about our priorities and vision for the future of Prisma ORM, check out our latest blog post: https://www.prisma.io/blog/prisma-orm-manifesto. Thank you for your understanding and ongoing support of the Prisma community! |
Awesome.
I just found out that we actually have an issue for making this functionality more structured via our CLI, see #6205. It is worded a bit "internal", but the outcome would be that we just help you if we identify a case like that to do the right thing and get it fixed. We are in a great position to do that.