diff options
Diffstat (limited to 'django/db/migrations/operations/special.py')
-rw-r--r-- | django/db/migrations/operations/special.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/django/db/migrations/operations/special.py b/django/db/migrations/operations/special.py index 91261f724f..2c995c54ac 100644 --- a/django/db/migrations/operations/special.py +++ b/django/db/migrations/operations/special.py @@ -1,5 +1,7 @@ from __future__ import unicode_literals +from django.db import router + from .base import Operation @@ -94,13 +96,13 @@ class RunSQL(Operation): state_operation.state_forwards(app_label, state) def database_forwards(self, app_label, schema_editor, from_state, to_state): - if self.allowed_to_migrate(schema_editor.connection.alias, None, hints=self.hints): + if router.allow_migrate(schema_editor.connection.alias, app_label, **self.hints): self._run_sql(schema_editor, self.sql) def database_backwards(self, app_label, schema_editor, from_state, to_state): if self.reverse_sql is None: raise NotImplementedError("You cannot reverse this operation") - if self.allowed_to_migrate(schema_editor.connection.alias, None, hints=self.hints): + if router.allow_migrate(schema_editor.connection.alias, app_label, **self.hints): self._run_sql(schema_editor, self.reverse_sql) def describe(self): @@ -171,7 +173,7 @@ class RunPython(Operation): pass def database_forwards(self, app_label, schema_editor, from_state, to_state): - if self.allowed_to_migrate(schema_editor.connection.alias, None, hints=self.hints): + if router.allow_migrate(schema_editor.connection.alias, app_label, **self.hints): # We now execute the Python code in a context that contains a 'models' # object, representing the versioned models as an app registry. # We could try to override the global cache, but then people will still @@ -181,7 +183,7 @@ class RunPython(Operation): def database_backwards(self, app_label, schema_editor, from_state, to_state): if self.reverse_code is None: raise NotImplementedError("You cannot reverse this operation") - if self.allowed_to_migrate(schema_editor.connection.alias, None, hints=self.hints): + if router.allow_migrate(schema_editor.connection.alias, app_label, **self.hints): self.reverse_code(from_state.apps, schema_editor) def describe(self): |