Repository navigation
Bug descriptionWe had an error reported in production during a recent migration when dropping an unused column with a foreign key constraint:
I'm not aware of anything we could have done differently at the application level to prevent this, so I'm wondering if this is a bug or our team is missing a technique for avoiding these errors. How to reproduce
(Not sure if this a 100% reliable repro -- we noticed this issue a few times in production.) Expected behaviorI would expect this migration to be safe during deploy. It's possible I'm missing some functionality within Prisma that makes these migrations safe. Perhaps there is a feature like The pattern I'm used to from Rails is:
With this approach, there is no downtime. Prisma informationSomething like: I'm not sure if the foreign key constraint is important or a red herring here. Environment & setup
Prisma Version |
Replies: 2 comments 7 replies
|
You removed a column, but did not update the Client or application code that uses the column, then get an error. Is that correct? What is the bug here? The only way to prevent this currently would be to remove all uses of the column/field from your code first, update your schema to remove the column, then deploy the updated Client (that does not know about the column any more), and then migrate the database. This will only work if the removed column is not required for INSERT operations. Is that what is possible via |
|
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! |
You removed a column, but did not update the Client or application code that uses the column, then get an error. Is that correct? What is the bug here?
The only way to prevent this currently would be to remove all uses of the column/field from your code first, update your schema to remove the column, then deploy the updated Client (that does not know about the column any more), and then migrate the database. This will only work if the removed column is not required for INSERT operations.
Is that what is possible via
ignored_columnsin Rails? If so, this sounds more like a feature request.