MCPcopy
hub / github.com/tortoise/tortoise-orm / add_dependency

Method add_dependency

tortoise/migrations/graph.py:83–106  ·  view source on GitHub ↗
(
        self,
        migration: MigrationKey,
        child: MigrationKey,
        parent: MigrationKey,
        *,
        skip_validation: bool = False,
    )

Source from the content-addressed store, hash-verified

81 self.nodes[key] = None
82
83 def add_dependency(
84 self,
85 migration: MigrationKey,
86 child: MigrationKey,
87 parent: MigrationKey,
88 *,
89 skip_validation: bool = False,
90 ) -> None:
91 if child not in self.nodes:
92 self.add_dummy_node(
93 child,
94 migration,
95 f"Migration {migration} references nonexistent child {child}",
96 )
97 if parent not in self.nodes:
98 self.add_dummy_node(
99 parent,
100 migration,
101 f"Migration {migration} references nonexistent parent {parent}",
102 )
103 self.node_map[child].add_parent(self.node_map[parent])
104 self.node_map[parent].add_child(self.node_map[child])
105 if not skip_validation:
106 self.validate_consistency()
107
108 def validate_consistency(self) -> None:
109 for node in self.node_map.values():

Calls 4

add_dummy_nodeMethod · 0.95
validate_consistencyMethod · 0.95
add_parentMethod · 0.80
add_childMethod · 0.80

Tested by 2