Answers for "duplicate key value violates unique constraint "django_migrations_pkey""

-1

duplicate key value violates unique constraint "django_migrations_pkey"

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()
Posted by: Guest on December-09-2020
-1

duplicate key value violates unique constraint "django_migrations_pkey"

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()
Posted by: Guest on December-09-2020

Code answers related to "duplicate key value violates unique constraint "django_migrations_pkey""

Browse Popular Code Answers by Language