# `Milvex.Migration.Version`

Helpers for normalising and comparing Milvus version strings.

Milvus reports versions like `"v2.6.1"`, `"2.6.1"`, or `"2.6.1-dev"`. This
module provides a single coercion entry point used by both `Plan` and
`Operation` so behaviour stays consistent.

The cutoff at which Milvus gained native field/function drop support is
exposed via `drop_field_supported_at/0` (currently `"2.6.0"`).

# `coerce`

```elixir
@spec coerce(String.t()) :: String.t()
```

Normalises a Milvus version string into a strict `MAJOR.MINOR.PATCH` semver
string suitable for `Version.compare/2`.

Trims whitespace, strips a leading `v`, drops any pre-release (`-`) or build
(`+`) suffix, pads missing components to three, and truncates extras. A string
with no leading numeric component falls back to `0.0.0` so a
malformed server version is treated conservatively (pre-2.6) rather than
raising.

    iex> Milvex.Migration.Version.coerce("v2.6.1")
    "2.6.1"

    iex> Milvex.Migration.Version.coerce("2.6.1")
    "2.6.1"

    iex> Milvex.Migration.Version.coerce("2.6.1-dev")
    "2.6.1"

    iex> Milvex.Migration.Version.coerce("  v2.6.1  ")
    "2.6.1"

    iex> Milvex.Migration.Version.coerce("2.6")
    "2.6.0"

    iex> Milvex.Migration.Version.coerce("2.6.1+build.5")
    "2.6.1"

    iex> Milvex.Migration.Version.coerce("")
    "0.0.0"

# `drop_field_supported_at`

```elixir
@spec drop_field_supported_at() :: String.t()
```

Returns the Milvus version at which native field/function drop is
supported. Versions below this require collection recreation.

---

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