Files
romm/backend/models/__init__.py
Georges-Antoine Assi fba415115e refactor(backend): load every model from one place
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>
2026-09-07 12:56:52 -04:00

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}")