# `mix cardbox.gen.migration`
[🔗](https://github.com/hattoriai/cardbox/blob/v0.1.0/lib/mix/tasks/cardbox.gen.migration.ex#L1)

Writes the migration that takes Cardbox's tables to their latest
version (`Cardbox.Migrations`).

    $ mix cardbox.gen.migration
    $ mix cardbox.gen.migration --migrations-path priv/other_repo/migrations

Then run `mix ecto.migrate`.

The first time, the migration makes the tables:

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

After an upgrade of Cardbox whose tables have a new version, it writes
the migration from the version your migrations pin, read from their
files (so it needs no database), to the new one. When they pin the
latest already, it writes nothing.

## Options

  * `--migrations-path` - where the migrations are, `priv/repo/migrations`
    unless given.

---

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