database migration
commonly-ts
PROOP

2 months ago

how do you go about migrating the data from a MySQL database to Postgres in the same project?

$20 Bounty

3 Replies

dardameiz
PRO

2 months ago

Hey, I am using DBeaver for my databases, dev: sqlite and preprod, prod, sandbox postgres. In DBeaver you can use SQL commands to migrate data or you can write a command file in your IDE (am using va code) that connects to those databases and do the data migrations.


medim
MODERATOR

2 months ago

Migrating from one DB to a different one is a bit complicated as it involves a lot of data types transformation and you will probably need an external software/script to do the conversion.
PostgreSQL wiki suggests using https://www.convert-in.com/mysql-to-postgres but it was last updated in 2023, I know about https://pgloader.io/ but I've never actually used it.


diogoribeirodev
FREETop 5% Contributor

2 months ago

Use pgloader as medim recommend, you can do it with a single command:

pgloader mysql://root@localhost/f1db pgsql:///f1db

you will probably need to define your casting rules ( convert mysql types to postgres types )
https://pgloader.io/about/ ( scroll down )


Loading...