# `Licet.Migration`
[🔗](https://github.com/netoum/licet/blob/v0.1.0/lib/licet/migration.ex#L1)

Creates and drops Licet's tables.

`mix licet.gen.migration` generates an Ecto migration that calls this module:

    defmodule Licet.Repo.Migrations.InstallLicet do
      use Ecto.Migration

      def up, do: Licet.Migration.up(prefix: "licet")

      def down, do: Licet.Migration.down(prefix: "licet")
    end

The tables live in their own Postgres schema, named by `:prefix`. The
statements use `IF NOT EXISTS`, so running `up/1` twice is harmless. In tests,
`Licet.Testing.migrate!/2` runs the same statements without a migration.

# `down`

```elixir
@spec down(keyword()) :: :ok
```

Drops the prefix's Postgres schema and every table in it. Call it from an
Ecto migration's `down/0`.

## Options

  * `:prefix` - the Postgres schema to drop. Defaults to `"licet"`.

# `migration_source`

```elixir
@spec migration_source(keyword()) :: String.t()
```

Returns the source of an Ecto migration module, as written by
`mix licet.gen.migration`.

## Options

  * `:prefix` - the Postgres schema for the tables. Defaults to `"licet"`.
  * `:module` - the migration module name. Defaults to
    `"Licet.Repo.Migrations.InstallLicet"`.

# `statements`

```elixir
@spec statements(String.t() | keyword()) :: [String.t()]
```

Returns the SQL statements that create the tables in a prefix.

Takes a prefix string or a keyword list with `:prefix`, which defaults to
`"licet"`.

# `up`

```elixir
@spec up(keyword()) :: :ok
```

Creates the tables. Call it from an Ecto migration's `up/0`.

## Options

  * `:prefix` - the Postgres schema for the tables. Defaults to `"licet"`.

---

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