Literature.Migration behaviour (literature v0.5.1)

Copy Markdown

Migrations create the database tables Literature needs.

Usage

To use migrations in your application you'll need to generate an Ecto.Migration that wraps calls to Literature.Migrations:

mix ecto.gen.migration add_literature

Open the generated migration in your editor and call the up and down functions on Literature.Migrations:

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

  def up, do: Literature.Migrations.up(version: 1)

  def down, do: Literature.Migrations.down(version: 1)
end

This will run the migrations for your database.

Now, run the migration to create the table:

mix ecto.migrate

Summary

Callbacks

down(t)

@callback down(Keyword.t()) :: :ok

migrated_version(t)

@callback migrated_version(Keyword.t()) :: non_neg_integer()

up(t)

@callback up(Keyword.t()) :: :ok

Functions

down(opts \\ [])

migrated_version(opts \\ [])

up(opts \\ [])