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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user