mirror of
https://github.com/django/django.git
synced 2025-10-28 08:06:09 +00:00
Fixed #24742 -- Made runserver.check_migrations ignore read-only databases
Thanks Luis Del Giudice for the report, and Aymeric Augustin and Markus Holtermann for the reviews.
This commit is contained in:
@@ -2,9 +2,12 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.apps.registry import Apps
|
||||
from django.db import models
|
||||
from django.db.utils import DatabaseError
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.timezone import now
|
||||
|
||||
from .exceptions import MigrationSchemaMissing
|
||||
|
||||
|
||||
class MigrationRecorder(object):
|
||||
"""
|
||||
@@ -49,8 +52,11 @@ class MigrationRecorder(object):
|
||||
if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):
|
||||
return
|
||||
# Make the table
|
||||
with self.connection.schema_editor() as editor:
|
||||
editor.create_model(self.Migration)
|
||||
try:
|
||||
with self.connection.schema_editor() as editor:
|
||||
editor.create_model(self.Migration)
|
||||
except DatabaseError as exc:
|
||||
raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc)
|
||||
|
||||
def applied_migrations(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user