Django
Models
Migrations
Example 1
- change model type e.g. Char to Integer : psycopg2.errors.InvalidTextRepresentation: invalid input syntax for type integer: ""
- alter field name in model ...try to delete field ...errors...
- to fix, try to rename, remove ... delete col by hand using psql, delete migrations, recreate migration ...
- problems: stuck in errors psycopg2.errors.DuplicateColumn: column "ccc" of relation "rrr" already exists
Example 2
- change of field to unique can result in "DETAIL: Key (id....)=() is duplicated."
Example 3
- if changing CharField to Unique the migration maybe does not convert the emty values to None?NULL and then one gets problems like: https://stackoverflow.com/questions/17257031/django-unique-null-and-blank-charfield-giving-already-exists-error-on-admin-p