Literature.Migration behaviour (literature v0.4.7)
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
@callback down(Keyword.t()) :: :ok
@callback migrated_version(Keyword.t()) :: non_neg_integer()
@callback up(Keyword.t()) :: :ok