mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
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']
|
||||
dbname = settings.DATABASES['default']['NAME']
|
||||
dbdefault = settings.DATABASES['default']
|
||||
|
||||
if dbname ==":memory:":
|
||||
# just run, and save the sql file
|
||||
print "-- ", settings.DATABASES['default']['NAME'], settings.DATABASES['default']['ENGINE']
|
||||
print "-- DATABASES.default", settings.DATABASES['default']
|
||||
self.runqonce()
|
||||
self.memdumpsql()
|
||||
self.saveprofiles()
|
||||
@ -263,7 +265,11 @@ class JobQueue():
|
||||
# run all the imports through :memory: first
|
||||
settings.DATABASES['default']['ENGINE'] = 'django.db.backends.sqlite3'
|
||||
settings.DATABASES['default']['NAME'] = ":memory:"
|
||||
settings.DATABASES['default']['USER'] = ""
|
||||
settings.DATABASES['default']['PASSWORD'] = ""
|
||||
|
||||
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,
|
||||
# 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
|
||||
# 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.
|
||||
settings.DATABASES['default'] = dbdefault
|
||||
settings.DATABASES['default']['ENGINE'] = dbengine
|
||||
settings.DATABASES['default']['NAME'] = dbname
|
||||
print "-- ", settings.DATABASES['default']['NAME'], settings.DATABASES['default']['ENGINE']
|
||||
|
Loading…
Reference in New Issue
Block a user