# `Sekisho.Migrations`
[🔗](https://github.com/hattoriai/sekisho/blob/v0.1.0-dev/lib/sekisho/migrations.ex#L1)

Sekisho's tables, in a migration of your app.

    $ mix sekisho.gen.migration

writes a migration that pins the latest version:

    defmodule MyApp.Repo.Migrations.AddSekisho do
      use Ecto.Migration

      def up, do: Sekisho.Migrations.up(version: 1)
      def down, do: Sekisho.Migrations.down(to: 0)
    end

The versions are `PhoenixMountable.Migrations`, tracked in your database.
A later version of Sekisho that changes its tables has a new version, and
`mix sekisho.gen.migration` writes the migration that upgrades.

The ids of the grants are of the type of your app's records: `:id`
(bigint) or `:binary_id` (uuid), from your repo's `:migration_primary_key`,
or `up(version: 1, primary_key: :binary_id)`. It is kept with the version,
so later versions use it too.

Version 1 makes `sekisho_grants` (`Sekisho.Grant`) and `sekisho_roles`
(`Sekisho.Role`).

# `check`

`:ok`, `{:pending, message}` or `{:outdated, message}`. Takes `:repo` and `:prefix`.

# `down`

Rolls the library's tables back to `:to` (default `0`). Call it from a host migration.

# `latest_version`

The latest version of the library's schema.

# `migrated_version`

The version the database is at (`0` when not installed).

# `run_backfills`

Runs deferred backfills to completion. Takes `:repo` and `:prefix`.

# `status`

The version, compatibility and backfills of a database. Takes `:repo` and `:prefix`.

# `up`

Migrates the library's tables up. Call it from a host migration.

# `verify`

Checks the tables against the library's schema. Takes `:repo` and `:prefix`.

---

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