<<<
--- django/db/migrations/recorder.py
+++ django/db/migrations/recorder.py
@@ -59,6 +59,9 @@
         """Ensure the table exists and has the correct schema."""
         if self.has_table():
             return
+        # NEW: Check if migration is allowed on this connection
+        if not router.allow_migrate(self.connection.alias, self.Migration):
+            return
         try:
             with self.connection.schema_editor() as editor:
                 editor.create_model(self.Migration)
>>>