# `MishkaCmsMigration.Provision`
[🔗](https://github.com/mishka-group/mishka_cms_migration/blob/v0.0.1/lib/mishka_cms_migration/provision.ex#L5)

What setting the migration up on a site gives it: the permission names its runs are gated by,
`admin:dashboard:migration` and `admin:api:migration`, so a site's admin can be granted them. The
names are shared by every site, so the first site's install creates them and every later one finds
them; the system writes them, whoever asked, through
`MishkaCmsCore.Install.Bootstrap.ensure_permissions/1`, as
`MishkaCmsCore.Runtime.ExtensionProvision` does for every extension. The extension ships no
components, pages or snippets.

The module is the extension's plugin on `installer:extension:install`
(`MishkaCmsCore.Install.Extensions`): subscribing is what makes the extension installable, and
`:extra` is what the installer's picker shows. It answers the payload whose `key` is
`"mishka_cms_migration"` with `install/2`'s report, appended to `reports`, and hands every other
payload on untouched. Installing needs `admin:dashboard:runtime:site`; a site's admin installs it
only on their own site. With no actor it runs only while the CMS itself is being installed.

The extension registers no settings, so it has no tab on the Settings page.

# `error_return`

```elixir
@type error_return() ::
  {:error, [%{action: atom(), field: atom(), message: String.t()}]}
```

# `okey_return`

```elixir
@type okey_return() :: {:ok, struct() | map() | module() | [any()]}
```

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `config`

```elixir
@spec config() :: keyword()
```

# `config`

```elixir
@spec config(atom()) :: any()
```

# `enable`

```elixir
@spec enable() :: okey_return() | error_return()
```

# `get`

```elixir
@spec get() :: keyword()
```

# `health_check`

```elixir
@spec health_check() :: :ok | {:degraded, term()} | {:error, term()}
```

Optional. See `c:MishkaInstaller.Event.Hook.health_check/0`. Override to report health.

# `install`

```elixir
@spec install(String.t(), map() | nil) ::
  MishkaCmsCore.Runtime.ExtensionProvision.report() | %{error: String.t()}
```

Installs the migration on `site_id` as `actor` and answers the report the installer shows, in the
shape of `t:MishkaCmsCore.Runtime.ExtensionProvision.report/0` (`permissions` names the ones
created by this install), or `%{error: message}` when `actor` may not.

# `on_dependency_error`

```elixir
@spec on_dependency_error(term()) :: term()
```

Optional. See `c:MishkaInstaller.Event.Hook.on_dependency_error/1`. Override to react.

# `register`

```elixir
@spec register() :: okey_return() | error_return()
```

# `restart`

```elixir
@spec restart() :: okey_return() | error_return()
```

# `start`

```elixir
@spec start() :: okey_return() | error_return()
```

# `start_link`

# `stop`

```elixir
@spec stop() :: okey_return() | error_return()
```

# `unregister`

```elixir
@spec unregister() :: okey_return() | error_return()
```

---

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