fix: hopefully fix startup continuum bug per 'active_history' models

only have one model in the wild (SpecialOrder) which uses
active_history and it probably shouldn't really..  it was written a
long time ago and would need some refactoring.

but for now we just need things to work, and this seems to do it
although i have no idea why
This commit is contained in:
Lance Edgar 2024-08-27 13:05:35 -05:00
parent f0f3352c5f
commit 0d949cbb4f

View file

@ -96,7 +96,17 @@ def configure_versioning(config, force=False, manager=None, plugins=None, **kwar
# TODO: is this the best way/place to confirm versioning?
app = config.get_app()
try:
# TODO: not sure why but if we don't load app.model here,
# for some reason the alembic upgrade command may fail, if
# any app models include the 'active_history' feature?!
model = app.model
# but when confirming if versioning is working, we
# definitely need to check a "native" model and not
# anything from app.model, which may use a totally
# different base class with no versioning (i.e. wutta)
from rattail.db.model import User
configure_mappers()
transaction_class = continuum.transaction_class(User)
config.versioning_has_been_enabled = True