summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/core/management/commands/makemigrations.py2
-rw-r--r--django/db/migrations/loader.py8
2 files changed, 7 insertions, 3 deletions
diff --git a/django/core/management/commands/makemigrations.py b/django/core/management/commands/makemigrations.py
index e172213176..9f20743869 100644
--- a/django/core/management/commands/makemigrations.py
+++ b/django/core/management/commands/makemigrations.py
@@ -49,7 +49,7 @@ class Command(BaseCommand):
# Load the current graph state. Pass in None for the connection so
# the loader doesn't try to resolve replaced migrations from DB.
- loader = MigrationLoader(None)
+ loader = MigrationLoader(None, ignore_no_migrations=True)
# Before anything else, see if there's conflicting apps and drop out
# hard if there are any and they don't want to merge
diff --git a/django/db/migrations/loader.py b/django/db/migrations/loader.py
index 0d961c2b69..26047b3a85 100644
--- a/django/db/migrations/loader.py
+++ b/django/db/migrations/loader.py
@@ -39,10 +39,11 @@ class MigrationLoader(object):
in memory.
"""
- def __init__(self, connection, load=True):
+ def __init__(self, connection, load=True, ignore_no_migrations=False):
self.connection = connection
self.disk_migrations = None
self.applied_migrations = None
+ self.ignore_no_migrations = ignore_no_migrations
if load:
self.build_graph()
@@ -156,7 +157,10 @@ class MigrationLoader(object):
else:
return list(self.graph.root_nodes(key[0]))[-1]
except IndexError:
- raise ValueError("Dependency on app with no migrations: %s" % key[0])
+ if self.ignore_no_migrations:
+ return None
+ else:
+ raise ValueError("Dependency on app with no migrations: %s" % key[0])
raise ValueError("Dependency on unknown app: %s" % key[0])
def build_graph(self):