Our Journey of migrating millions of records from MongoDB to Postgres

Image for post
Image for post
Photo by Liz Sanchez-Vegas on Unsplash

As a part of improving users experience within our company’s ecosystem, we decided to extract a piece of important functionality from a huge monolith mess to a separate independent service. Once the service was ready, the next step was to migrate millions of data from the old database, hosted in MongoDB, to a new one in Postgres. Not to mention the source database had many redundant and duplicate data, we also wanted to clean during this ETL process.

Since we were already using Go for most of our services, it was obvious for us to use the same language to…

Ever struggled with large file upload in PHP? Wondered if you could continue uploading where you left off without re-uploading whole data again in case of any interruptions? If this sounds familiar to you, then keep reading.

Image for post
Image for post
Photo by rawpixel.com on Unsplash

File upload is a common task we do in almost all of our modern web projects. With all different tools available, it is not that hard to implement file upload feature in any language. But, still, when it comes to large file upload things gets a bit complicated.

Say, you are trying to upload a fairly large file. You have been waiting for…

This is the continuation of my previous article where we talked about creating a multi-tenant app using Laravel and Postgres. I recommend you to read that article before moving forward with this one.

Since our multi-tenant app is ready, we want to utilize Laravel’s console commands to handle our migrations. In this article, we will see how we can extend Laravel’s migration implementation to gracefully handle migrations for all schemas of our multi-tenant app.


Laravel provides easy console commands within migrate namespace to handle migrations. eg:

$ php artisan migrate
$ php artisan migrate:rollback

But, as you might have…

Image for post
Image for post

Let’s say, we have a web app, powered by Laravel and Postgres, that runs across different countries in South East Asia. Each venture will have their own users, products, categories etc. so to make it more manageable we want to have a separate database for each venture. But since we are using Postgres we can leverage schemas which I will describe shortly.

I am using Laravel 5.5 and PostgreSQL 9.5 for my setup. You will find me using the word Tenant or Venture interchangeably to represent the country.

First things first — Tenant identification

The first thing we want to do in our multi-tenant web-app is…

Ankit Pokhrel🇳🇵

…always confused 🙃

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store