From 16f032e69fb9c06fd0d9feda35bba12195651214 Mon Sep 17 00:00:00 2001 From: Jim Nicholls Date: Sat, 13 Aug 2016 19:33:58 +1000 Subject: [1.10.x] Fixed #27054 -- Fixed makemigrations crash with a read-only database. Backport of 76ab8851181675a59425f9637bdbf3f2de95f6f1 from master --- django/db/migrations/loader.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'django') diff --git a/django/db/migrations/loader.py b/django/db/migrations/loader.py index d459f2c524..e5a7f031f9 100644 --- a/django/db/migrations/loader.py +++ b/django/db/migrations/loader.py @@ -6,6 +6,7 @@ from importlib import import_module from django.apps import apps from django.conf import settings +from django.db.migrations.exceptions import MigrationSchemaMissing from django.db.migrations.graph import MigrationGraph from django.db.migrations.recorder import MigrationRecorder from django.utils import six @@ -273,7 +274,12 @@ class MigrationLoader(object): unapplied dependencies. """ recorder = MigrationRecorder(connection) - applied = recorder.applied_migrations() + try: + applied = recorder.applied_migrations() + except MigrationSchemaMissing: + # Skip check if the django_migrations table is missing and can't be + # created. + return for migration in applied: # If the migration is unknown, skip it. if migration not in self.graph.nodes: -- cgit v1.3