View Source Dagex.Migrations (dagex v2.0.0)

Migrations create and modify the database tables Dagex needs to function.

Usage

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

mix ecto.gen.migration add_dagex

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

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

  def up, do: Dagex.Migrations.up()

  def down, do: Dagex.Migrations.down()
end

This will run all of Dagex's versioned migrations for your database. Migrations between versions are idempotent. As new versions are released you may need to run additional migrations.

Now, run the migration to create the table:

mix ecto.migrate

Link to this section Summary

Functions

Run the down changes for all migrations between the current version and the initial version.

Run the up changes for all migrations between the initial version and the current version.

Link to this section Functions

Specs

down(opts :: keyword()) :: :ok

Run the down changes for all migrations between the current version and the initial version.

Example

Run all migrations from current version down to the first:

Dagex.Migrations.down()

Run migrations down to a specified version:

Dagex.Migrations.down(version: 5)
Link to this macro

setup_node_type(table_name, binary)

View Source (macro)

Specs

setup_node_type(String.t(), String.t()) :: Macro.t()

Specs

up(opts :: keyword()) :: :ok

Run the up changes for all migrations between the initial version and the current version.

Example

Run all migrations up to the current version:

Dagex.Migrations.up()

Run migrations up to a specified version:

Dagex.Migrations.up(version: 2)