1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #27142, #27110 -- Made makemigrations consistency checks respect database routers.

Partially reverted refs #27054 except for one of the tests as this
solution supersedes that one.

Thanks Shai Berger for the review.
This commit is contained in:
Tim Graham
2016-09-01 16:19:29 -04:00
committed by GitHub
parent 32c02f2a0e
commit 098c07a032
6 changed files with 48 additions and 29 deletions

View File

@@ -4,12 +4,11 @@ from unittest import skipIf
from django.db import connection, connections
from django.db.migrations.exceptions import (
AmbiguityError, InconsistentMigrationHistory, MigrationSchemaMissing,
NodeNotFoundError,
AmbiguityError, InconsistentMigrationHistory, NodeNotFoundError,
)
from django.db.migrations.loader import MigrationLoader
from django.db.migrations.recorder import MigrationRecorder
from django.test import TestCase, mock, modify_settings, override_settings
from django.test import TestCase, modify_settings, override_settings
from django.utils import six
@@ -484,12 +483,3 @@ class LoaderTests(TestCase):
('app1', '4_auto'),
}
self.assertEqual(plan, expected_plan)
def test_readonly_database(self):
"""
check_consistent_history() ignores read-only databases, possibly
without a django_migrations table.
"""
with mock.patch.object(MigrationRecorder, 'ensure_schema', side_effect=MigrationSchemaMissing()):
loader = MigrationLoader(connection=None)
loader.check_consistent_history(connection)