Updated docs

This commit is contained in:
2026-09-02 17:34:20 +00:00
parent d33f3f9c2f
commit ab5b7584c9
8 changed files with 284 additions and 473 deletions
+12
View File
@@ -0,0 +1,12 @@
# Migrations
Adding or removing a field and other such simple operations are automatic, but when the time comes to really change your data model, implement a `migrate_v1` function that converts your old data to the new form. This works on plain built-in dict and other types, to avoid needing to preserve old versions of your structs.
Pass a module (or import path) containing `migrate_vN` functions:
```python
kanta = Kanta("data.kantadb", Data(), migrations="myapp.migrations")
await kanta.open()
```
Kanta tracks migration version metadata automatically, and fast forwards your database to current version by running all the migrations needed while opening the database.