def wrapper_fixture(test_migrations): recorder = MigrationRecorder(connection) Migration = recorder.Migration with django_db_blocker.unblock(): table_exists = recorder.has_table() if not table_exists: with connection.schema_editor(atomic=False) as editor: editor.create_model(recorder.Migration) for app, name in test_migrations: m = Migration( app=app, name=name, ) m.save()
def _check_migration_db_exists(self): recorder = MigrationRecorder(self.connection) if not recorder.has_table(): raise CommandError("No migration table present")