From c65544a377fc0511b337e9567e013afb59cc717c Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Wed, 22 Jul 2020 23:51:50 +0100 Subject: [PATCH] differences between sqlite and MariaDB --- databaseReset.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/databaseReset.py b/databaseReset.py index 085da49..7510ce3 100644 --- a/databaseReset.py +++ b/databaseReset.py @@ -93,12 +93,20 @@ def reinit_db(): print(" - Migrating: " + django.db.connections.databases['default']['NAME']) - with transaction.atomic(): + if django.db.connections.databases['default']['ENGINE'] == 'django.db.backends.sqlite3': + with transaction.atomic(): + management.call_command('makemigrations','core', interactive=False) + management.call_command('makemigrations','flatpages', interactive=False) + management.call_command('migrate', interactive=False) + management.call_command('migrate','core', interactive=False) + management.call_command('migrate','flatpages', interactive=False) + else: management.call_command('makemigrations','core', interactive=False) management.call_command('makemigrations','flatpages', interactive=False) management.call_command('migrate', interactive=False) management.call_command('migrate','core', interactive=False) management.call_command('migrate','flatpages', interactive=False) + print(" - done migration on: " + settings.DATABASES['default']['NAME']) print("users in db already: ",len(User.objects.all()))