forked from expo/troggle
more thorough reset between dbs
This commit is contained in:
parent
b1596c0ac4
commit
f326bf9148
@ -252,10 +252,12 @@ class JobQueue():
|
|||||||
|
|
||||||
dbengine = settings.DATABASES['default']['ENGINE']
|
dbengine = settings.DATABASES['default']['ENGINE']
|
||||||
dbname = settings.DATABASES['default']['NAME']
|
dbname = settings.DATABASES['default']['NAME']
|
||||||
|
dbdefault = settings.DATABASES['default']
|
||||||
|
|
||||||
if dbname ==":memory:":
|
if dbname ==":memory:":
|
||||||
# just run, and save the sql file
|
# just run, and save the sql file
|
||||||
print "-- ", settings.DATABASES['default']['NAME'], settings.DATABASES['default']['ENGINE']
|
print "-- ", settings.DATABASES['default']['NAME'], settings.DATABASES['default']['ENGINE']
|
||||||
|
print "-- DATABASES.default", settings.DATABASES['default']
|
||||||
self.runqonce()
|
self.runqonce()
|
||||||
self.memdumpsql()
|
self.memdumpsql()
|
||||||
self.saveprofiles()
|
self.saveprofiles()
|
||||||
@ -263,7 +265,11 @@ class JobQueue():
|
|||||||
# run all the imports through :memory: first
|
# run all the imports through :memory: first
|
||||||
settings.DATABASES['default']['ENGINE'] = 'django.db.backends.sqlite3'
|
settings.DATABASES['default']['ENGINE'] = 'django.db.backends.sqlite3'
|
||||||
settings.DATABASES['default']['NAME'] = ":memory:"
|
settings.DATABASES['default']['NAME'] = ":memory:"
|
||||||
|
settings.DATABASES['default']['USER'] = ""
|
||||||
|
settings.DATABASES['default']['PASSWORD'] = ""
|
||||||
|
|
||||||
print "-- ", settings.DATABASES['default']['NAME'], settings.DATABASES['default']['ENGINE']
|
print "-- ", settings.DATABASES['default']['NAME'], settings.DATABASES['default']['ENGINE']
|
||||||
|
print "-- DATABASES.default", settings.DATABASES['default']
|
||||||
|
|
||||||
# but because the user may be expecting to add this to a db with lots of tables already there,
|
# but because the user may be expecting to add this to a db with lots of tables already there,
|
||||||
# the jobque may not start from scratch so we need to initialise the db properly first
|
# the jobque may not start from scratch so we need to initialise the db properly first
|
||||||
@ -287,6 +293,7 @@ class JobQueue():
|
|||||||
# restore the original db and import again
|
# restore the original db and import again
|
||||||
# if we wanted to, we could re-import the SQL generated in the first pass to be
|
# if we wanted to, we could re-import the SQL generated in the first pass to be
|
||||||
# blazing fast. But for the present just re-import the lot.
|
# blazing fast. But for the present just re-import the lot.
|
||||||
|
settings.DATABASES['default'] = dbdefault
|
||||||
settings.DATABASES['default']['ENGINE'] = dbengine
|
settings.DATABASES['default']['ENGINE'] = dbengine
|
||||||
settings.DATABASES['default']['NAME'] = dbname
|
settings.DATABASES['default']['NAME'] = dbname
|
||||||
print "-- ", settings.DATABASES['default']['NAME'], settings.DATABASES['default']['ENGINE']
|
print "-- ", settings.DATABASES['default']['NAME'], settings.DATABASES['default']['ENGINE']
|
||||||
|
Loading…
Reference in New Issue
Block a user