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()))