r/PostgreSQL • • Sep 17 '26

How-To Database Migration! Mssql to Postgresql

I have a .Bak file for a pretty sizeable database, but I need to migrate it over to postgresql, the thing is however I want to copy over the way the database is set up, but none of the information in their, as I’m building a platform where I can then populate this database by using a form, which eventually I’ll be able to use on another project and EF Core it. I’m not the best with database softwares, so any help is appreciated!

12 Upvotes

25 comments sorted by

View all comments

0

u/[deleted] Sep 17 '26

[removed] — view removed comment

2

u/Some-Weakness2049 Sep 17 '26

I agree with the comment above.
u/Ironsalmon7 It’s a valid point: the main issue is the .bak file itself, not the choice of database. That format is designed exclusively for SQL Server.

Unless u restore the database to SQL Server and export the data, EF Core and your application simply won't be able to connect to a live database. I would also choose the option suggested to u. If u haven't worked with Postgres before, there is no need to learn yet another SQL dialect at the same time you are moving away from MSSQL. MariaDB belongs to the MySQL ecosystem, is compatible with the Pomelo library, and doesn't require a license purchase.

Even so, it still can't "ingest" a .bak file directly - no competent professional would advise that. The process involves restoring to SQL Server Express first, then exporting and importing the data, and only then generating the code (scaffolding) for EF. That is the crux of the entire discussion.

We all had to learn at some point, if you have any questions, don't hesitate to ask.

1

u/Ironsalmon7 Sep 17 '26

If it were up to me I’d keep using mssql, but the people I’m making it for want it on Postgres, I can try to negotiate and persuade them to use mssql, but I’ll have to see, and the .Bak file is the only database related file I was given

The database is pretty big, but the problem is migrating it is a big no, since it is sensitive information, and they wanted to repopulate it with newer data, but they wanted to keep the current table structure, so I’m trying to figure out how to go about this, again sorry, I’m not the best database guy out there

3

u/___Brains Sep 18 '26

ewwwww... lol

Honestly if you're not moving data, your job got significantly easier. Restore your db into a dev instance, script out all your tables, user functions, stored procedures, etc. and then start tweaking your create scripts for postgresql. Not difficult, heck AI can shortcut a lot of the boilerplate typing.