Jaz*_*Tpt 4 python migration django django-models django-south
每次尝试运行新迁移时,我的南迁移历史记录表都会导致完整性错误.这是错误:
django.db.utils.IntegrityError: duplicate key value violates unique constraint "south_migrationhistory_pkey"
DETAIL: Key (id)=(40) already exists.
Run Code Online (Sandbox Code Playgroud)
到目前为止,这只发生在当地.我已经删除了数据库并重建了很多次,并且每次所有现有迁移都顺利运行.但是一旦我创建了新的迁移,我就会再次收到此错误.
迁移40碰巧是第三方迁移(djangoratings),所以我不认为这是迁移文件的问题.
任何帮助将不胜感激!
怎么样
SELECT setval('south_migrationhistory_id_seq', (SELECT MAX(id) FROM south_migrationhistory));
这对我有用.
你可能应该pg_dump事先做一件事,以防万一都出错了.
我正在使用postgres,您可能需要使用稍微不同的命令来更新其他数据库的数据库序列.
| 归档时间: |
|
| 查看次数: |
996 次 |
| 最近记录: |