# `AshScylla.SchemaLoader`
[🔗](https://github.com/ohhi-vn/ash_scylla/blob/main/lib/ash_scylla/schema_loader.ex#L15)

Loads and discovers schema migration modules from `priv/<repo>/migrations`.

## Discovery

`discover/0` scans all apps (current + umbrella) for `.ex` files under
`priv/<repo>/migrations/` and returns sorted file paths.

## Loading

`load/1` requires the file, checks for `change/0`, and calls
`AshScylla.Schema.flatten/1` to normalize the result to a flat CQL list.

Supports both flat CQL string lists and struct-based `%AshScylla.Schema{}`
entries.

# `loaded`

```elixir
@type loaded() :: {:ok, module()} | {:error, term()}
```

# `discover`

```elixir
@spec discover() :: [String.t()]
```

Discovers all `.exs` files under `priv/<repo>/migrations` for the current project.

# `load`

```elixir
@spec load(String.t()) :: {:ok, [String.t()]} | {:error, term()}
```

Loads a schema module from a file path and returns its `change/0` statements.

Supports both flat CQL string lists and struct-based `%AshScylla.Schema{}`
entries. Struct-based entries are automatically flattened via
`AshScylla.Schema.flatten/1`.

---

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