Open kvesteri opened 11 years ago
I've written a script that creates a new history object for all existing versioned object. All these new entries have the operation create
and are associated with the transaction with id 1. Is this what you are looking for here?
@dtheodor Five years later; do you have this script? This is what I'm looking for.
@anthony-arnold this seems to work for me
versioning_manager = VersioningManager(transaction_cls=AuditTransaction)
uow = versioning_manager.unit_of_work(DBSession)
uow.create_transaction(DBSession)
uow.operations.add_insert(obj)
uow.make_versions(DBSession)
Thanks @dvschramm that worked for me also
When user has an existing project and starts using SA-Continuum the following problems are exposed:
For example lets say we have articles and users (each article has one user as owner). The articles and users are already in the database when the developer migrates the whole project to use Continuum. Then user updates article A. When user calls:
It returns None, because there is no history yet for this user object.
Solution:
Lets make a migration function which generates history records for all versioned table rows.