def migrate(memo_type: type) -> None
Apply pending tag-field schema migration for a memo type.
Use db0.migrate(...) when automatic tag-field migration is disabled with no_auto_migrate=True and the running class declaration differs from the declaration stored in the prefix.
Parameters
memo_typetype
The@db0.memoclass whose pending tag-field declaration should be applied.
Returns
This function does not return a value.
Example
import dbzero as db0
db0.init("/var/lib/my-app/dbzero", no_auto_migrate=True)
db0.open("main")
@db0.tag_fields("status")
@db0.memo
class Task:
def __init__(self, status):
self.status = status
try:
Task("open")
except db0.MigrateError:
db0.migrate(Task)After db0.migrate(Task) completes, the current @db0.tag_fields(...) declaration becomes active for that type. Existing objects are retagged according to the new declaration, and future assignments use the new tag-field settings.
If migration fails, the previous declaration remains active.