Migration from NoSql to Sql , MongoDB to PostgreSql with PRISMA.

christian_birego_e9b83eaa

Christian Birego

Posted on July 2, 2024

Migration from NoSql to Sql , MongoDB to PostgreSql with PRISMA.

In my career as a backend developer, I've recently come across a big challenge, that of moving from a Nosql database to an sql database. This task turned out to be complicated, but it gave me the ability to learn more. Today I'm going to share my experience with you!

an application using mongodb to store data, but for technical and maintenance reasons we decided to switch to postgress to benefit from more complex functionalities and queries. and this in a migration without disrupting the user experience. which was a great challenge.

the first step was to plan the migration, so I started by doing a study of the data structure in mongodb to arrange and structure it well for the migration. then I made a relationship diagram adapted to postgresql. planning was the most crucial step because at the slightest error I could lose everything or misconnect the data.

Prisma became my earliest and most valuable ally in this process. Configuring prisma with postgress seemed easier than doing it with PGSL. prisma made DB management easier by providing me with tools to help me create and manipulate my data in an intuitive and visible way in a graphical interface in the browser on prisma studio.

after defending the schema and configuration in prisma, the migration was easier but more delicate. I had to export the data from my nosQL DB and import it into the sql DB. with a little patience and delicacy, I transferred all the data. once the migration was complete, we ran a series of tests to verify the presence of all the data, while optimizing the performance of the database, which was satisfactory.

this migration has become for me the greatest technical experience I've had in my career as a backend developer. thanks to hng for allowing me to express my knowledge and find out more about hng.

thank you for reading all the way to the end.

christian birego

💖 💪 🙅 🚩
christian_birego_e9b83eaa
Christian Birego

Posted on July 2, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related