Django: Difference between revisions

From annawiki
(Created page with "==Models== *change model type e.g. Char to Integer : psycopg2.errors.InvalidTextRepresentation: invalid input syntax for type integer: "" *alter field name in model ...try to...")
 
Line 1: Line 1:
==Models==
==Models==
===Migratioins===
Example 1
*change model type e.g. Char to Integer : psycopg2.errors.InvalidTextRepresentation: invalid input syntax for type integer: ""
*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...
*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 ...  
*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
*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."

Revision as of 2022-04-28T20:12:43

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