简体   繁体   English

Django - 迁移混淆了?

[英]Django - Migrations mixed up?

I've been working on a contract project in Django, and I performed some updates for the live server, including updates that went from South to an up to date Django version.我一直在 Django 中从事一个合同项目,我对实时服务器进行了一些更新,包括从 South 到最新 Django 版本的更新。

I was attempting to follow the instructions in the documentation, which states to delete all the old migration files except init , and then use makemigrations and "python manage.py migrate --fake-initial".我试图按照文档中的说明操作,其中指出删除除init之外的所有旧迁移文件,然后使用 makemigrations 和“python manage.py migrate --fake-initial”。

But it turns out database permissions were screwy.但事实证明,数据库权限很糟糕。 I was not able to apply the update.我无法应用更新。

The server owner (who was the past contractor) did not yet realize that there was a permission issue, and tried the update on his own.服务器所有者(他是过去的承包商)尚未意识到存在权限问题,并自行尝试了更新。

The server is now working, but he stated to me he " had to do many changes to the migrations working because there was no old migrations ".服务器现在正在运行,但他对我说他“必须对正在运行的迁移进行许多更改,因为没有旧的迁移”。

I am assuming he did not know the proper way to upgrade from South to integration migrations with Django, and did it all manually rather than letting Django migrations do the work .我假设他不知道从 South 升级到与 Django 集成迁移的正确方法,并且所有这些都是手动完成的,而不是让 Django 迁移来完成工作

Well now I am ready for future updates, but I look in the migrations folder, and it looks like both the old migrations files as well as the new migrations files are in there?好吧,现在我已准备好接受未来的更新,但我查看了迁移文件夹,看起来旧的迁移文件和新的迁移文件都在那里? An example: http://screencast.com/t/gYQdc1tl4 (notice the dates).一个例子: http : //screencast.com/t/gYQdc1tl4 (注意日期)。

Everything seems to be working, but I am wondering... how should I go about future migrations from here?一切似乎都在工作,但我想知道......我应该如何从这里进行未来的迁移? Will a regular makemigrations/migrate work?定期的 makemigrations/migrate 工作吗? Or should I do the --fake-initial again?或者我应该再次执行 --fake-initial 吗?

Any suggestions please?请问有什么建议吗? Since we strayed from documentation I'm unsure of how to go about this next.由于我们偏离了文档,我不确定接下来如何进行。

Thanks谢谢

如果现在一切正常并且您不需要为您的开发服务器进行迁移,那么我将删除所有旧迁移(做备份!)并使用--fake-initial从“新迁移” --fake-initial

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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