django.db.utils.IntegrityError: column "venue_city" contains null values django.db.utils.IntegrityError: column "venue_city" contains null values postgresql postgresql

django.db.utils.IntegrityError: column "venue_city" contains null values


Looks like you added null=True after created migration file. Because venue_city is not a nullable field in your migration file

Follow these steps.

1) Drop venue_city & venue_country from your local table3) Delete all the migration files you created for these `CharField to a ForeignKey` change4) execute `python manage.py makemigrations`5) execute 'python manage.py migrate'

It should work


Had a similar problem i resolved it by removing the previous migration files.No technical explanation


I solved it by just adding null = True to both the (automatically generated) migration file that was causing the issue and in the Model. Then migrate again and your failed migration will now succeed. As you changed it also in your model, makemigration will detect no changes after that.