# `Alternera.Resource.Migrations`
[🔗](https://github.com/10e-ab/alternera-sdk/blob/v0.9.0/alternera_resource_sdk/lib/alternera/resource/migrations.ex#L1)

Runs a resource package's migrations into its own Postgres schema.

The schema is created first, and `Ecto.Migrator` runs with that schema as
its prefix, so the package's `schema_migrations` table lives inside it.
Dropping an orphaned package's schema therefore drops its migration record
too, and a package added back later migrates from scratch.

The proxy's `Alternera.Resources.Migrator` and the package test kit
(`Alternera.Resource.Test`) both run packages through here.

# `migrate`

```elixir
@spec migrate(module(), Path.t(), keyword()) :: [integer()]
```

Runs every pending migration under `path` for the package of `domain` on
`Alternera.Resource.Repo`, which must be started (or, in the proxy's
tests, routed to a started repo). Returns the versions it ran. Extra
`opts` go to `Ecto.Migrator.run/4`.

# `schema`

```elixir
@spec schema(module()) :: String.t()
```

The package's Postgres schema, `"resources_<package id>"`.

---

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