Changes between Initial Version and Version 1 of Ticket #29574, comment 8


Ignore:
Timestamp:
Nov 22, 2022, 2:47:59 PM (2 years ago)
Author:
Bhuvnesh

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29574, comment 8

    initial v1  
    1 hi, i was working around to find the real cause of this issue and i am writing my observation here but i am not sure if they are fully correct or not, it would be really helpful if someone could cross-check/confirm.
    2 1. when {{{a_ptr}}} is created its a primary key hence has UNIQUE constraint.
    3 2. since {{{a_ptr}}} is a non nullable field it asks for a default value to populate the existing rows(even for empty db). And as we provide default value the UNIQUE constraint fails.
    4 3. Now as UNIQUE constraints failed , it defies one of the rule of foreign key constraints given [https://www.sqlite.org/foreignkeys.html here] (Under the heading Required and Suggested Database Indexes) which says {{{The parent key columns named in the foreign key constraint are not the primary key of the parent table and are not subject to a unique constraint using collating sequence specified in the CREATE TABLE}}}. This subsequently leads to the {{{"foreign key mismatch - "models_c" referencing "models_b""}}} error.
     1~~hi, i was working around to find the real cause of this issue and i am writing my observation here but i am not sure if they are fully correct or not, it would be really helpful if someone could cross-check/confirm.~~
     2~~1. when {{{a_ptr}}} is created its a primary key hence has UNIQUE constraint.~~
     3~~2. since {{{a_ptr}}} is a non nullable field it asks for a default value to populate the existing rows(even for empty db). And as we provide default value the UNIQUE constraint fails.~~
     4~~3. Now as UNIQUE constraints failed , it defies one of the rule of foreign key constraints given [https://www.sqlite.org/foreignkeys.html here] (Under the heading Required and Suggested Database Indexes) which says {{{The parent key columns named in the foreign key constraint are not the primary key of the parent table and are not subject to a unique constraint using collating sequence specified in the CREATE TABLE}}}. This subsequently leads to the {{{"foreign key mismatch - "models_c" referencing "models_b""}}} error.~~
    55
    6 I'm using django dev version and its giving me error as soon as i migrate second time.
     6~~I'm using django dev version and its giving me error as soon as i migrate second time.~~
Back to Top