有更好的迁移方式吗?其实我更喜欢做mysqldump,把转储从MySQL转换成PostgreSQL格式,然后加载到PostgreSQL。你推荐哪个软件可以执行这样的转储转换,并从MySQL数据类型正确转换为PostgreSQL,例如tinyint(1)到boolean?
编辑感谢大家的帮助。我使用 github/maxlapshin/mysql2postgres 实用程序成功地迁移了我的数据库。然而,在导入转储后,我仍然需要自己重新生成PostgreSQL数据库中的序列。
解决方案有几个转换器,例如Ruby中的一个: github/maxlapshin/mysql2postgres
I would like to convert my Django project's database from MySQL to PostgreSQL. Unfortunately, I can't just use Django's "dumpdata" and "loaddata" management commands because my database tables are too big. I already read the article www.ofbrooklyn/2010/07/18/migrating-django-mysql-postgresql-easy-way/, but it seems that to use this method in practice I'll still need to turn it into something like a management command that iterates over available models when it copies model instances and when resets sequences. Besides, it doesn't seem very fast either because it issues save() on each model instance.
Is there a better way to migrate? Actually, I would prefer to do "mysqldump", convert the dump from MySQL to PostgreSQL format somehow and then load it to PostgreSQL. What piece of software would you recommend that could perform such dump conversion and correctly convert from MySQL data types to PostgreSQL ones, for example tinyint(1) to boolean?
Edit Thanks everyone for your help. I successfully migrated my database using github/maxlapshin/mysql2postgres utility. However, I still had to reset sequences in the resulting PostgreSQL database myself after importing the dump.
解决方案There are several converters for it, for example this one in Ruby: github/maxlapshin/mysql2postgres
更多推荐
将Django项目从MySQL迁移到PostgreSQL的最简单的方法
发布评论