MCPcopy Index your code
hub / github.com/tortoise/tortoise-orm / _project_state

Method _project_state

tortoise/migrations/executor.py:218–235  ·  view source on GitHub ↗
(
        self, applied: set[MigrationKey], *, upto: MigrationKey | None = None
    )

Source from the content-addressed store, hash-verified

216 raise ValueError(f"Cannot find migration {migration_name!r} in app {app_label!r}")
217
218 async def _project_state(
219 self, applied: set[MigrationKey], *, upto: MigrationKey | None = None
220 ) -> State:
221 default_connections = {
222 label: config.get("default_connection", "default")
223 for label, config in self.loader.apps_config.items()
224 }
225 state = State(models={}, apps=StateApps(default_connections=default_connections))
226 for key in self._full_plan():
227 if key not in applied:
228 continue
229 if upto and key == upto:
230 break
231 migration = self.loader.graph.nodes[key]
232 if migration is None:
233 raise ValueError(f"Missing migration for {key}")
234 await migration.apply(state, dry_run=True, schema_editor=None)
235 return state
236
237 async def _project_state_cache(self, applied: set[MigrationKey]) -> dict[MigrationKey, State]:
238 default_connections = {

Callers 2

migrateMethod · 0.95
collect_sqlMethod · 0.95

Calls 6

_full_planMethod · 0.95
StateClass · 0.90
StateAppsClass · 0.90
itemsMethod · 0.80
applyMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected