mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-15 02:57:17 +00:00
Speed up migrations and init
This commit is contained in:
@@ -85,6 +85,7 @@ def reinit_db():
|
|||||||
else:
|
else:
|
||||||
print(" - No database file found: " + currentdbname + " ..continuing, will create it.\n")
|
print(" - No database file found: " + currentdbname + " ..continuing, will create it.\n")
|
||||||
else:
|
else:
|
||||||
|
with transaction.atomic():
|
||||||
cursor = django.db.connection.cursor()
|
cursor = django.db.connection.cursor()
|
||||||
cursor.execute("DROP DATABASE %s" % currentdbname)
|
cursor.execute("DROP DATABASE %s" % currentdbname)
|
||||||
cursor.execute("CREATE DATABASE %s" % currentdbname)
|
cursor.execute("CREATE DATABASE %s" % currentdbname)
|
||||||
@@ -93,6 +94,7 @@ def reinit_db():
|
|||||||
|
|
||||||
print(" - Migrating: " + django.db.connections.databases['default']['NAME'])
|
print(" - Migrating: " + django.db.connections.databases['default']['NAME'])
|
||||||
|
|
||||||
|
with transaction.atomic():
|
||||||
management.call_command('makemigrations','core', interactive=False)
|
management.call_command('makemigrations','core', interactive=False)
|
||||||
management.call_command('makemigrations','flatpages', interactive=False)
|
management.call_command('makemigrations','flatpages', interactive=False)
|
||||||
management.call_command('migrate', interactive=False)
|
management.call_command('migrate', interactive=False)
|
||||||
|
|||||||
Reference in New Issue
Block a user