I have an application that has been running for a solid 2 years now and has a lot of data in it. I needed to add some functionality recently that interacts with some old stuff. I had to add some migrations but also make changes to some database records that were holding some "options".
Those options needed some changing when migrating, so I went ahead and added some code in the up() function of the migration to change to what I wanted, and also did the reverse on the down() function, in case something goes wrong in the migration and I need to roll stuff back https://100001.onl/ .
The problem I have now is that when running tests that use DB, all tests fail because the migrations don't work anymore, because there are constraint violations that occur when running that custom code in the up() and down() functions.
I could just delete the code at this point, which will solve my situation, and it wouldn't be a big deal because deployment was successful, but i am curious how would one handle such a situation? What would a standard procedure be, if there is one? or what is a more robust method that would avoid these pitfalls and others that i haven't encountered in this particular case.