Django

From annawiki

Models

Migratioins

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."