mirror of
https://github.com/django/django.git
synced 2025-08-30 23:37:50 +00:00
Fixed #27858 -- Prevented read-only management commands from creating the django_migrations table.
MigrationRecorder now assumes that if the django_migrations table doesn't exist, then no migrations are applied. Reverted documentation change from refs #23808.
This commit is contained in:
parent
4f1eb64ad0
commit
fda55c71a8
7 changed files with 30 additions and 32 deletions
|
@ -22,7 +22,6 @@ from django.core.management import (
|
|||
BaseCommand, CommandError, call_command, color,
|
||||
)
|
||||
from django.db import ConnectionHandler
|
||||
from django.db.migrations.exceptions import MigrationSchemaMissing
|
||||
from django.db.migrations.recorder import MigrationRecorder
|
||||
from django.test import (
|
||||
LiveServerTestCase, SimpleTestCase, TestCase, override_settings,
|
||||
|
@ -1339,15 +1338,12 @@ class ManageRunserver(AdminScriptTestCase):
|
|||
|
||||
def test_readonly_database(self):
|
||||
"""
|
||||
Ensure runserver.check_migrations doesn't choke when a database is read-only
|
||||
(with possibly no django_migrations table).
|
||||
runserver.check_migrations() doesn't choke when a database is read-only.
|
||||
"""
|
||||
with mock.patch.object(
|
||||
MigrationRecorder, 'ensure_schema',
|
||||
side_effect=MigrationSchemaMissing()):
|
||||
with mock.patch.object(MigrationRecorder, 'has_table', return_value=False):
|
||||
self.cmd.check_migrations()
|
||||
# Check a warning is emitted
|
||||
self.assertIn("Not checking migrations", self.output.getvalue())
|
||||
# You have # ...
|
||||
self.assertIn('unapplied migration(s)', self.output.getvalue())
|
||||
|
||||
|
||||
class ManageRunserverMigrationWarning(TestCase):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue