#2225: 'manage.py sql ...' gets confused when using tables from separate apps
---------------------------------------------------+------------------------
          Reporter:  Lucas Hazel                   |         Owner:  
glassresistor
            Status:  new                           |     Milestone:             
  
         Component:  Database layer (models, ORM)  |       Version:  SVN        
  
        Resolution:                                |      Keywords:             
  
             Stage:  Accepted                      |     Has_patch:  0          
  
        Needs_docs:  0                             |   Needs_tests:  0          
  
Needs_better_patch:  0                             |  
---------------------------------------------------+------------------------
Comment (by glassresistor):

 After looked through the logs from a postgres 8.4 database I found that
 the actual queries used to create the 3 tables above through syncdb does
 not include the alter statement but instead is just a part of the create
 statement.  Syncdb seems to check the full project space while sql,
 sqlall, sqlreset, since they take in apps as arguments loop through the
 listed apps and inside that, loops through models internal to the apps
 themselves.  I propose that sqls behaviour be changed such that the models
 list get concatenated such that sql would in the case of sql app2 spit out
 -- The following references should be added but depend on non-existent
 tables:
 but sql app1 app2 would spit out Create table statements without
 mentioning an alter which doesn't get done.

 {{{
 618-2009-12-13 10:27:27 EST LOG:  statement: CREATE TABLE "app1_a" (
 619-        "id" serial NOT NULL PRIMARY KEY,
 620-        "article_body" text NOT NULL
 621-    )
 622-    ;
 623-2009-12-13 10:27:27 EST LOG:  statement: CREATE TABLE "app1_c" (
 624-        "id" serial NOT NULL PRIMARY KEY,
 625-        "key_id" integer NOT NULL REFERENCES "app1_a" ("id")
 DEFERRABLE INITIALLY DEFERRED
 626-    )
 627-    ;
 628:2009-12-13 10:27:27 EST LOG:  statement: CREATE TABLE "app2_b" (
 629-        "id" serial NOT NULL PRIMARY KEY,
 630-        "a_id" integer NOT NULL REFERENCES "app1_a" ("id") DEFERRABLE
 INITIALLY DEFERRED
 631-    )
 632-    ;
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/2225#comment:6>
Django <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 django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.


Reply via email to