diff --git a/other/v2-migration.mdx b/other/v2-migration.mdx index b6c5acc8c..2d4fa284c 100644 --- a/other/v2-migration.mdx +++ b/other/v2-migration.mdx @@ -39,6 +39,20 @@ Notice: - The script is idempotent. If something goes wrong or if you stop it mid-run, you can run it again. - Metrics are automatically converted from v1 to v2 format. +## Migrating your VectorDB + +If you used a VectorDB in v1, your vector tables need the two new columns introduced in v2: `content_hash` and `content_id`. + +Use our migration script: [`libs/agno/migrations/v1_to_v2/migrate_vectordbs_to_v2.py`](https://github.com/agno-agi/agno/blob/main/libs/agno/migrations/v1_to_v2/migrate_vectordbs_to_v2.py) + +The script supports PgVector and SingleStore. Set the database URL and the config listing the schema and the tables to migrate at the top of the script and run it. + +Notice: + +- The script is idempotent. It skips tables that already have both columns. +- Creating a `PgVector` instance won't migrate existing tables. `create()` only creates tables that don't exist. +- Until the migration runs, writes to a v1 table fail with `column "content_id" of relation "..." does not exist`. + ## Migrating your Agno code Each section here covers a specific framework domain, with before and after examples and detailed explanations where needed. @@ -248,7 +262,7 @@ from any sources. For a full example of the usage, see the [Content Types](/know Furthermore, we now support deletion of individual vectors using the `remove_vector_by_id()`, `remove_vectors_by_name()` and `remove_vectors_by_metadata()` methods. You can also delete all vectors created by a specific piece of content using `remove_content_by_id()`. -4.4 To support the deletion mentioned above, VectorDB tables have been updated. Two new columns, `content_hash` and `content_id`, have been added. +4.4 To support the deletion mentioned above, VectorDB tables have been updated. Two new columns, `content_hash` and `content_id`, have been added. See [Migrating your VectorDB](#migrating-your-vectordb) to update existing tables. 4.5. The `retriever` field has been renamed to `knowledge_retriever`.