Browse Source

Refactor

pull/15982/head
Alper Ebiçoğlu 3 years ago
committed by GitHub
parent
commit
db20b7105b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      docs/en/Community-Articles/2023-03-15-Migration-Mssql-Postgresql/POST.md

15
docs/en/Community-Articles/2023-03-15-Migration-Mssql-Postgresql/POST.md

@ -1,11 +1,10 @@
# Migration from Mssql to Postgresql # Migration from Mssql to Postgresql
![sql-server-to-postgres](images/sql-server-to-postgres.jpg) ![sql-server-to-postgres](images/sql-server-to-postgres.jpg)
## Introduction ## Introduction
Database migration is a common practice for organizations that want to move from one database system to another. This can be for a variety of reasons, including cost, performance, and features. In this article, we will discuss the process of migrating a database from MSSQL to PostgreSQL, the challenges that may arise during the migration, and how to overcome them. Database migration is a common practice for organizations that want to move from one database system to another. This can be for a variety of reasons, including cost, performance, and features. In this article, we will discuss the process of migrating a database from MSSQL to PostgreSQL, the challenges that may arise during the migration, and how to overcome them. And we recently moved the main database of https://abp.io platform from MSSQL to PostgreSQL.
In our case, we decided to switch our database from Microsoft SQL Server (MSSQL) to PostgreSQL because we wanted to move our on-premise platform to Azure. We’ve also found out that the cost of the license for MSSQL on Azure was significantly higher than PostgreSQL. After conducting a cost-benefit analysis, we decided to migrate our database to PostgreSQL to save costs. In our case, we decided to switch our database from Microsoft SQL Server (MSSQL) to PostgreSQL because we wanted to move our on-premise platform to Azure. We’ve also found out that the cost of the license for MSSQL on Azure was significantly higher than PostgreSQL. After conducting a cost-benefit analysis, we decided to migrate our database to PostgreSQL to save costs.
@ -18,20 +17,20 @@ Despite using a third-party tool(DBConvert for MySQL & PostgreSQL) for the migra
![db-converter](images/db-converter.jpg) ![db-converter](images/db-converter.jpg)
Secondly, our database had to be case-insensitive, but PostgreSQL does not have this as a default configuration. We handled it using “citext” with the abp migration service. Secondly, our database had to be case-insensitive, but PostgreSQL does not have this as a default configuration. We handled it using `citext` with the ABP migration service.
![citext-1](images/citext-1.jpg) ![citext-1](images/citext-1.jpg)
![citext-2](images/citext-2.jpg) ![citext-2](images/citext-2.jpg)
![citext-3](images/citext-3.jpg) ![citext-3](images/citext-3.jpg)
Finally, we had problems with importing binary data, such as the content of the NuGet packages.It was hard to understand that the binaries of the NuGet packages were different. The part that bothered us the most was the transfer of the NuGet packages. Fortunately, we overcame the binary error, thanks to the tool made by talented developers in a very short time. While everything was proceeding very smooth, we faced one last problem: importing binary data, such as the content of the NuGet packages. It was hard to understand that the binaries of the NuGet packages were different. Our paid commercial NuGet packages are being stored as binary data in the database. Therefore, it was the most compelling part of this migration to transfer the NuGet packages. Fortunately, we overcame the binary error. And we decided to write a custom .NET tool to move only the binary data from MSSQL to PostgreSQL, thanks to the ABP Core team!
## Conclusion
One of the benefits of using PostgreSQL is that there is no need to make any changes to the code except for the migration service. This means that the applications that were previously using MSSQL can seamlessly switch to PostgreSQL without any modifications. ## Conclusion
Thanks to the flexibility of ABP, it became compatible with PostgreSQL with only a few changes in the migration service. This means that we did not need to modify any of the application's core functionality, and the migration process was smooth and seamless. One of the benefits of using PostgreSQL is the low license costs of the Azure platform. As the main contributors of ABP, we also use ABP Framework under the hood of our abp.io websites, we could easily switch to PostgreSQL. For those who want to switch their ABP project to PostgreSQL, check out [docs.abp.io/en/abp/latest/Entity-Framework-Core-PostgreSQL](https://docs.abp.io/en/abp/latest/Entity-Framework-Core-PostgreSQL). We had not used any MSSQL specific function, therefore there was no need to make any changes in the repository classes. This means that the applications that were previously using MSSQL can seamlessly switch to PostgreSQL without any modifications.
In conclusion, migrating a database from MSSQL to PostgreSQL can be challenging, but it can bring significant cost savings in the long run. By testing and fine-tuning the migration process before making the final switch, we were able to overcome the challenges we’d faced during the migration process. Thanks to the flexibility of ABP, we were able to make the transition with minimal code changes. Thanks to the flexibility of ABP, it has [PostgreSQL package](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.PostgreSql) which is 100% compatible with PostgreSQL. This helped us to make this migration very smooth and seamless.
In conclusion, migrating a database from MSSQL to PostgreSQL can be challenging, but it can bring significant cost savings in the long run. By testing and fine-tuning the migration process before making the final switch, we were able to overcome the challenges we’d faced during the migration process. Thanks to the flexibility of ABP, we were able to make the transition with minimal code changes. Also we didn't see any big performance differences between MSSQL and PostgreSQL.

Loading…
Cancel
Save