You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The operation is reversible (apart from any data loss, which of course is irreversible) if the field is nullable or if it has a default value that can be used to populate the recreated column. If the field is not nullable and does not have a default value, the operation is irreversible.
I imagine retrospectively adding a migration between 0001 and 0002 (to add default='') would have prevented this issue, but it is a bit too late to do so.
The only way, in my opinion, is to add the default='' to the original definition - which shouldn't impact anyone already using django-cities.
Checklist
master
branch of django-cities.Steps to reproduce
Expected behavior
No errors
Actual behavior
psycopg2.IntegrityError: column "continent_code" contains null values
Full output (including Traceback):
https://gist.github.com/leibowitz/0427c3e70ffb07d81e1ecf82b349cf00
This is due to the last
RemoveField
of the 0002_continent_models_and_foreign_keys.py migrationAs the documentation mentions:
Source: https://docs.djangoproject.com/en/2.0/ref/migration-operations/#removefield
Adding
default=''
to theCountry.continent
field definitiondjango-cities/cities/migrations/0001_initial.py
Line 64 in 422e92d
I imagine retrospectively adding a migration between 0001 and 0002 (to add
default=''
) would have prevented this issue, but it is a bit too late to do so.The only way, in my opinion, is to add the
default=''
to the original definition - which shouldn't impact anyone already usingdjango-cities
.#199
The text was updated successfully, but these errors were encountered: