Milvex.Schema.Migration
(milvex v0.10.2)
Copy Markdown
Implements schema migration for Milvus collections.
Provides functionality to:
- Create collections from DSL definitions
- Verify existing schemas against expected definitions
- Ensure indexes are created and up-to-date
Options
:strict- Whentrue, raises on schema mismatches instead of logging warnings. Useful for CI/CD pipelines. Default:false
Examples
# Basic migration
Milvex.Schema.Migration.migrate!(conn, MyApp.Movies, [])
# Strict mode (fails on schema mismatch)
Milvex.Schema.Migration.migrate!(conn, MyApp.Movies, strict: true)
Summary
Functions
Migrates a collection module to Milvus.
Verifies that the existing collection schema matches the expected schema.
Types
Functions
@spec migrate!(GenServer.server(), module(), keyword()) :: :ok
Migrates a collection module to Milvus.
If the collection exists, verifies the schema matches. If not, creates it. Always ensures indexes are properly configured.
Options
:strict- Raise on schema mismatch instead of warning. Default:false- Any additional options are passed to Milvus API calls.
Returns
:okon success- Raises
Milvex.Erroron failure
@spec verify_schema!(GenServer.server(), module(), String.t(), keyword()) :: {:ok, :match} | {:ok, {:mismatch, schema_diff()}}
Verifies that the existing collection schema matches the expected schema.
Options
:strict- Raise on mismatch instead of warning. Default:false
Returns
{:ok, :match}- Schemas match{:ok, {:mismatch, diff}}- Schemas differ (only in non-strict mode)- Raises in strict mode when schemas don't match