# `Milvex.Schema.Migration`

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` - When `true`, 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)

# `schema_diff`

```elixir
@type schema_diff() :: %{
  missing: [String.t()],
  extra: [String.t()],
  mismatches: [{String.t(), map(), map()}]
}
```

# `migrate!`

```elixir
@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

- `:ok` on success
- Raises `Milvex.Error` on failure

# `verify_schema!`

```elixir
@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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
