#29717: Provide a way for tests to run on an existing empty DB
-------------------------------------+-------------------------------------
     Reporter:  Curtis Maloney       |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  2.1
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  1
  Needs tests:  1                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Curtis Maloney):

 Replying to [comment:3 Tim Graham]:
 > Thanks for clarifying. Maybe the Oracle-specific
 [https://docs.djangoproject.com/en/dev/ref/settings/#create-db CREATE_DB]
 setting in DATABASES 'OPTIONS' does what you want to do for PostgreSQL?
 Possibly that might just be another way to do "keepdb" -- I didn't
 investigate enough to confirm.
 >

 From the docs:
 {{{
 If it is set to False, the test tablespaces won’t be automatically created
 at the beginning of the tests or dropped at the end.
 }}}

 This is _close_ to what I was after. However, I'd want it to create and
 tear down the models, etc.

 So really we want to build a matrix of steps:

 1. (a) Create DB --OR-- (b) Clear DB
 1. Apply migrations
 1. Revert migrations
 1. Drop DB

 Normally we affect all steps, with 3 implied by 4. Using --keepdb skips 3
 and 4. I'm looking for a way to allow only 1(b), 2, and 3.

 My current solution to step 3 is excessive, in that it will drop
 _everything_, not just the objects we created in migrations.  I don't
 believe there is currently a simple way to migrate everything to ZERO,
 instead we'd likely need to iterate the installed apps and do them
 individually.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29717#comment:4>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.6cf7a772a01dc607c194d7c7a236ff51%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to