开发者

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

开发者 https://www.devze.com 2023-02-26 07:21 出处:网络
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 imple

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 so开发者_JAVA技巧rt of thing and I don't really know to start.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号