We ran npm install
and updated some dependencies, and found out that our nestjs
projects that used v5 mikro-orm development
project stopped working.
We started getting depedency injection errors and looking around in the github issues some other people where having the same
problems. The proposed solution in one of them was updating from v6 to v6.0.1
As we had not updated iu. It seems a dependency of @mikro-orm/nestjs
package received a breaking change update with minor
version bump. Resulting in breaking compatibility with v5 mikro-orm.
As this issue happened, and updating package-lock.json manually without much information on where the problem actually is, and
any update to packages in production environment could lead to application issues and stalled development, we chose update
mikro-orm
from v5 to v6.
Inspired by Storybook's migrations scripts, and because of the large quantity of files we had to update in all our nestjs microservices. I decided to create my own migration script to make things way easier.
Note:
I started this by doing the migration manually with regex and replace, then I tought it could be easily reproduced with a
migration script. Also, I'm working a lot with LLM's and local LLM's as a hobby, so I wanted to test differences in the
result code from different models for different languages given a set of very clear and precise instructions in plain english. So, the migration script was generated big part by GPT-4
using the prompt at prompt.txt
. Then the code was modified to fix some small issues. I left it all there in case you want to play with it.
DISCLAIMER: I am not responsible for the results of this migration, I chose to open source it to other people as it could be helpful for others, but I do not guarantee at all that is going to work for you. You might need to make some changes.