1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[1.10.x] Fixed #27054 -- Fixed makemigrations crash with a read-only database.

Backport of 76ab885118 from master
This commit is contained in:
Jim Nicholls
2016-08-13 19:33:58 +10:00
committed by Tim Graham
parent c24a47b3e6
commit 16f032e69f
4 changed files with 45 additions and 4 deletions

View File

@@ -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: