Django South-无法重置应用程序迁移
我正在尝试重置我的南方迁移历史记录,但无法为myapp运行迁移。My settings.py是:Django South-无法重置应用程序迁移,django,postgresql,django-south,database-migration,Django,Postgresql,Django South,Database Migration,我正在尝试重置我的南方迁移历史记录,但无法为myapp运行迁移。My settings.py是: ... 'south', 'myapp', 'allauth', 'allauth.account', 'allauth.socialaccount', 'allauth.socialaccount.providers.facebook', 'payments', 不幸的是,我尝试过的东西对我不起作用: 删除/rm所有现有迁移文件 除了南方以外的所有地方都要注释掉 运行初始syncdb 为每个应用
...
'south',
'myapp',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.facebook',
'payments',
不幸的是,我尝试过的东西对我不起作用:
/manage.py schemamigration应用程序\u name--initial
hostMigrations:
! These migrations are in the database but not on disk:
<myapp: 0002_..._>
! I'm not trusting myself; either fix this yourself by fiddling
! with the south_migrationhistory table, or pass --delete-ghost-migrations
! to South to have it delete ALL of these records (this may not be good).
主机迁移:
! 这些迁移位于数据库中,但不在磁盘上:
! 我不相信自己;要么你自己动手解决这个问题
! 使用south_migrationhistory表,或pass--delete ghost迁移
! 到南方让它删除所有这些记录(这可能不好)。
如果我通过--delete ghost迁移,那么它会告诉我myapp没有什么可迁移的,而事实显然不是这样。当我冒充0002时,它告诉我在0002之后没有其他东西可以迁移。还有别的办法吗 要完全删除迁移历史记录,需要删除数据库表中的每一行 转到数据库并删除
south\u migrationhistory
表中的所有行:
delete from south_migrationhistory;
或者,如果您只想重置特定应用程序的历史记录,您可以执行以下操作:
delete from south_migrationhistory where app_name='your_app_name';
希望这有帮助 出于好奇,
--delete ghost migrations
在这种情况下会做同样的事情吗?我认为它做的不止这些,这就是为什么它会产生上述错误。我多次在重置迁移时遇到困难,这是完全由我完全重置控制的最直接的方法。你可能是对的,但我只需从south_migration_history中删除app_name='myapp',这样我就不必运行其他迁移并再次陷入其他麻烦:)。如果我错了,请纠正我你是对的,我只是假设他想要完全重置。这实际上只会重置应用程序的迁移。我会在回答中更正它。谢谢你的反馈。Paulo,谢谢,但是删除south_migrationhistory表并不能解决myapp的“无需迁移”问题。仅显示初始myapp 0001迁移,但有[00]13个。south正在为我的其他项目应用程序识别额外的迁移,但是-我该怎么做才能让它忽略myapp的迁移?