#2493: Error "reset"ing app with self-referencing ForeignKey
-----------------------------------+----------------------------------------
   Reporter:  [EMAIL PROTECTED]  |                Owner:  empty           
     Status:  new                  |            Component:  Database wrapper
    Version:  SVN                  |           Resolution:                  
   Keywords:  sprintdec01          |                Stage:  Unreviewed      
  Has_patch:  0                    |           Needs_docs:  0               
Needs_tests:  1                    |   Needs_better_patch:  0               
-----------------------------------+----------------------------------------
Changes (by empty <[EMAIL PROTECTED]>):

  * owner:  anonymous => empty
  * status:  assigned => new

Comment:

 The issue of the ticket is not really the reason for this comment, but
 rather the larger issue of understanding the design goals of the sqlreset
 / reset commands.  To me the best approach when constructing the drop
 statements is to use introspection solely to figure out what needs to be
 dropped.  This includes not only for the foreign key
 relationships but also for the tables themselves.

 With the current design the table and foreign key information is
 pulled together from the model information itself.  The problem with
 that is that if someone manually changes the name of an foreign key
 constraint or removes the constraint entirely then the constructed
 information will differ from what is in the database and therefore the
 drop statements will fail.

 In addition, somewhat related to this, if a user attempts to change
 the name of a model and then does a reset it will fail, because the
 constraint names and the table name itself will no longer match up to
 what is being constructed by the sql_delete function.

 If introspection is used entirely for the constructing the drop
 statements then it would solve all of the above issues.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/2493#comment:8>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to