Setup exports in the infra __init__.py

This helps avoid issues where model classes are not evaluated. If the models
are not properly imported then Sqlalchemy can explode during database initialization
since the mapped columns have not yet been registered.

Later, having the models all imported into __init__.py will help with setting
up a test db since it will ensure that the registrations for all models is happening
as the classes are evaluated during the imports in the package init file.
This commit is contained in:
Campbell Alden 2026-09-03 22:57:55 +09:00
parent f44f054f56
commit 0d270c9cfb
2 changed files with 28 additions and 2 deletions

View file

@ -0,0 +1,27 @@
from .db import Base, CRUD, CRUDRepo, UpdateMissingEntryError, get_database
from .users import UserModel, UserRepoImpl
from .publication import (
PublicationEntryModel,
PublicationSequenceModel,
PublicationOrderModel,
PublicationModel,
PublicationRepoImpl,
)
from .subscription import SubscriptionModel, SubscriptionRepoImpl
__all__ = [
'Base',
'CRUD',
'CRUDRepo',
'UpdateMissingEntryError',
'get_database',
'UserModel',
'UserRepoImpl',
'PublicationEntryModel',
'PublicationSequenceModel',
'PublicationOrderModel',
'PublicationModel',
'PublicationRepoImpl',
'SubscriptionModel',
'SubscriptionRepoImpl',
]