Arcadic.Migration behaviour (Arcadic v0.1.0)

Copy Markdown View Source

Behaviour for an ArcadeDB migration — a versioned pair of forward/backward steps. Migrations are tenant-blind schema changes; author raw DDL/DML via Arcadic.command/4 in up/1 and down/1.

defmodule MyApp.Migrations.V1 do
  @behaviour Arcadic.Migration
  @impl true
  def version, do: 1
  @impl true
  def up(conn), do: Arcadic.command!(conn, "CREATE VERTEX TYPE User", %{}, language: "sql") && :ok
  @impl true
  def down(conn), do: Arcadic.command!(conn, "DROP TYPE User IF EXISTS", %{}, language: "sql") && :ok
end

Summary

Callbacks

Reverse the migration.

Apply the migration.

A unique, ascending version (integer — typically a timestamp).

Callbacks

down(t)

@callback down(Arcadic.Conn.t()) :: :ok

Reverse the migration.

up(t)

@callback up(Arcadic.Conn.t()) :: :ok

Apply the migration.

version()

@callback version() :: pos_integer()

A unique, ascending version (integer — typically a timestamp).