mirror of
https://github.com/rommapp/romm.git
synced 2026-12-04 21:02:21 +01:00
env.py listed the model modules by hand so autogenerate would see them, and this branch had already had to patch six omissions into that list. Walk the package instead, from a helper the index-drift test can share. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
13 lines
414 B
Python
13 lines
414 B
Python
import importlib
|
|
import pkgutil
|
|
|
|
|
|
def load_all_models() -> None:
|
|
"""Import every module under `models/` so `BaseModel.metadata` is complete.
|
|
|
|
A table missing from the metadata makes alembic autogenerate propose
|
|
dropping it, so both `alembic/env.py` and the drift test load them all.
|
|
"""
|
|
for module in pkgutil.iter_modules(__path__):
|
|
importlib.import_module(f"{__name__}.{module.name}")
|