From 4550549c2c0f484b2b14f75c6e1997d53e822e6c Mon Sep 17 00:00:00 2001 From: Brian Wiborg Date: Mon, 29 Sep 2025 19:54:45 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=91=EF=B8=8F=20Remove=20flat=5Flabel?= =?UTF-8?q?=20artifact?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ohmyapi/core/runtime.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/ohmyapi/core/runtime.py b/src/ohmyapi/core/runtime.py index 87127f8..7b0c340 100644 --- a/src/ohmyapi/core/runtime.py +++ b/src/ohmyapi/core/runtime.py @@ -119,26 +119,18 @@ class Project: def build_aerich_command( self, app_label: str, db_url: Optional[str] = None ) -> AerichCommand: - # Resolve label to flat_label - if app_label in self._apps: - flat_label = app_label - else: - candidate = app_label.replace(".", "_") - if candidate in self._apps: - flat_label = candidate - else: - raise RuntimeError(f"App '{app_label}' is not registered") + if app_label not in self._apps: + raise RuntimeError(f"App '{app_label}' is not registered") # Get a fresh copy of the config (without aerich.models anywhere) tortoise_cfg = copy.deepcopy(self.build_tortoise_config(db_url=db_url)) # Append aerich.models to the models list of the target app only - if flat_label in tortoise_cfg["apps"]: - tortoise_cfg["apps"][flat_label]["models"].append("aerich.models") + tortoise_cfg["apps"][app_label]["models"].append("aerich.models") return AerichCommand( tortoise_config=tortoise_cfg, - app=flat_label, + app=app_label, location=str(self.migrations_dir), )