将一个 Django 应用程序迁移到另一个应用程序的最佳方法是什么
我正在开发一个 Django 项目,我必须使用 South 将一个应用程序迁移到另一个应用程序。我有旧的内部消息应用程序,我必须将其替换为另一个完全不同的应用程序。我想知道是否可以通过 orm,但旧应用程序在 INSTALLED_APPS 中不再存在,所以没有意义。使用 SQL 过程可以做到这一点吗?我当时想保持应用程序数据库类型独立。
I am working on a Django project where I have to use South to migrate one application to another. I have the old internal message application which I have to replace by another completely different. I was wondering if I could pass by orm, but the old application doesn't exist anymore in the INSTALLED_APPS, so no sense. Does using a SQL procedure is the way to do that? I'd like to keep the application DB type independant at the time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Django 应用程序在数据库中命名,因此您应该能够临时安装这两个应用程序。我将其分解为大约三个迁移:
Django applications are namespaced in the database so you ought to be able to temporarily have both applications installed. I would break it down to about three migrations:
schemamigration:python manage.py schemamigration myapp(具有可为空的外键)
datamigration:Django 自定义 sql 是我的朋友 -> https://docs.djangoproject.com/en/dev/topics/db/ sql/
制作了我的自定义数据迁移脚本,使项目数据库保持独立
使用2删除旧的应用程序架构。
(可选)向后救援脚本
schemamigration: python manage.py schemamigration myapp (with nullable foreign keys)
datamigration: Django custom sql is my friend -> https://docs.djangoproject.com/en/dev/topics/db/sql/
have made my custom data migration script keeping the project DB independent
remove the old application schema using 2.
(optional) a backwards rescue script