# `Narabe.Migration`
[🔗](https://github.com/hattoriai/narabe/blob/v0.1.0/lib/narabe/migration.ex#L2)

The column of an item's position, in a migration: a text compared byte
by byte, as position keys must be (see `Narabe.Position`).

    defmodule MyApp.Repo.Migrations.CreateCards do
      use Ecto.Migration
      import Narabe.Migration

      def change do
        create table(:cards) do
          add :title, :string
          add :column_id, references(:columns)
          position()
        end

        create index(:cards, [:column_id, :position])
      end
    end

The column is `:string`, not null when you say so (`null: false`), with
the collation that compares bytes: `"C"` on Postgres, `utf8mb4_bin` on
MySQL; SQLite compares bytes already. For a column that already exists,
`alter_position/2` changes its collation.

Index the position after the item's scope (its list, column or parent):
a list is read in its order with that index.

# `alter_position`

```elixir
@spec alter_position(atom(), keyword()) :: :ok
```

Makes an existing column compare bytes, in an `alter table`: for a
position column added before Narabe.

# `position`

```elixir
@spec position(atom(), keyword()) :: :ok
```

Adds a position column (`:position` unless named), in a `create table`
or `alter table`. Options go to `Ecto.Migration.add/3` (`null: false`).

---

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