简体   繁体   中英

Migrating Data from a MySQL database to a PostgreSQL database with a different schema

I am migrating my site from PHP to Rails.

At the same time I want to migrate my database from MySQL to PostgreSQL. However, the schema I have in the MySQL database is poor. Therefore, I want to implement a new schema in the PostgreSQL database.

Basically, I want take the data from the MySQL database and I want to fit it to the new schema in the PostgreSQL database. The new tables in the PostgreSQL database consisted of joined views from the MySQL database.

I am new to this sort of thing and I don't really know to start.

If your schemas are radically different, you are going to have to write a script to do the necessary transformations. You can use a Database Abstraction Layer to handle the differences between MySQL and PostgreSQL, but for the most part you're on your own.

I had to to this in the past - your answer is a called "taps":

http://adam.heroku.com/past/2009/2/11/taps_for_easy_database_transfers/

It's basically a middle-man between mysql and postgres and will be able to handle all the differences between them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM