📜  重复键值违反唯一约束“django_admin_log_pkey” - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:36.130000             🧑  作者: Mango

代码示例2
from django.db import connections

query = "SELECT setval('django_migrations_id_seq', (SELECT MAX(id) FROM django_migrations))"
cursor = connections['default'].cursor()
cursor.execute(query) 
row = cursor.fetchone()