Loading django/core/management/commands/makemigrations.py +2 −0 Original line number Diff line number Diff line Loading @@ -47,7 +47,9 @@ class Command(BaseCommand): # Load the current graph state. Takes a connection, but it's not used # (makemigrations doesn't look at the database state). # Also make sure the graph is built without unmigrated apps shoehorned in. loader = MigrationLoader(connections[DEFAULT_DB_ALIAS]) loader.build_graph(ignore_unmigrated=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 Loading django/db/migrations/loader.py +28 −23 Original line number Diff line number Diff line Loading @@ -135,7 +135,7 @@ class MigrationLoader(object): else: return self.disk_migrations[results[0]] def build_graph(self): def build_graph(self, ignore_unmigrated=False): """ Builds a migration dependency graph using both the disk and database. You'll need to rebuild the graph if you apply migrations. This isn't Loading Loading @@ -200,6 +200,10 @@ class MigrationLoader(object): # even have migrations. if parent[1] == "__first__" and parent not in self.graph: if parent[0] in self.unmigrated_apps: if ignore_unmigrated: migration.dependencies.remove(parent) parent = None else: # This app isn't migrated, but something depends on it. # We'll add a fake initial migration for it into the # graph. Loading @@ -226,6 +230,7 @@ class MigrationLoader(object): parent = list(self.graph.root_nodes(parent[0]))[0] else: raise ValueError("Dependency on unknown app %s" % parent[0]) if parent is not None: self.graph.add_dependency(key, parent) def detect_conflicts(self): Loading Loading
django/core/management/commands/makemigrations.py +2 −0 Original line number Diff line number Diff line Loading @@ -47,7 +47,9 @@ class Command(BaseCommand): # Load the current graph state. Takes a connection, but it's not used # (makemigrations doesn't look at the database state). # Also make sure the graph is built without unmigrated apps shoehorned in. loader = MigrationLoader(connections[DEFAULT_DB_ALIAS]) loader.build_graph(ignore_unmigrated=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 Loading
django/db/migrations/loader.py +28 −23 Original line number Diff line number Diff line Loading @@ -135,7 +135,7 @@ class MigrationLoader(object): else: return self.disk_migrations[results[0]] def build_graph(self): def build_graph(self, ignore_unmigrated=False): """ Builds a migration dependency graph using both the disk and database. You'll need to rebuild the graph if you apply migrations. This isn't Loading Loading @@ -200,6 +200,10 @@ class MigrationLoader(object): # even have migrations. if parent[1] == "__first__" and parent not in self.graph: if parent[0] in self.unmigrated_apps: if ignore_unmigrated: migration.dependencies.remove(parent) parent = None else: # This app isn't migrated, but something depends on it. # We'll add a fake initial migration for it into the # graph. Loading @@ -226,6 +230,7 @@ class MigrationLoader(object): parent = list(self.graph.root_nodes(parent[0]))[0] else: raise ValueError("Dependency on unknown app %s" % parent[0]) if parent is not None: self.graph.add_dependency(key, parent) def detect_conflicts(self): Loading