Ecto v3.0.0-dev Ecto.Adapter.Migration behaviour View Source

Specifies the adapter migrations API.

Link to this section Summary

Types

All migration commands

A DDL object is a struct that represents a table or index in a database schema. These database objects can be modified through the use of a Data Definition Language, hence the name DDL object

All commands allowed within the block passed to table/2

Callbacks

Executes migration commands

The callback responsible for locking the migrations table and emitting the locked versions for callback execution

Checks if the adapter supports ddl transaction

Link to this section Types

Link to this type command() View Source
command() :: raw :: String.t | {:create, Ecto.Migration.Table.t, [table_subcommand]} | {:create_if_not_exists, Ecto.Migration.Table.t, [table_subcommand]} | {:alter, Ecto.Migration.Table.t, [table_subcommand]} | {:drop, Ecto.Migration.Table.t} | {:drop_if_exists, Ecto.Migration.Table.t} | {:create, Ecto.Migration.Index.t} | {:create_if_not_exists, Ecto.Migration.Index.t} | {:drop, Ecto.Migration.Index.t} | {:drop_if_exists, Ecto.Migration.Index.t}

All migration commands

A DDL object is a struct that represents a table or index in a database schema. These database objects can be modified through the use of a Data Definition Language, hence the name DDL object.

Link to this type table_subcommand() View Source
table_subcommand ::
  {:add, field :: atom, type :: Ecto.Type.t | Ecto.Migration.Reference.t, Keyword.t} |
  {:modify, field :: atom, type :: Ecto.Type.t | Ecto.Migration.Reference.t, Keyword.t} |
  {:remove, field :: atom}

All commands allowed within the block passed to table/2

Link to this section Callbacks

Link to this callback execute_ddl(repo, command, options) View Source
execute_ddl(repo :: Ecto.Repo.t, command, options :: Keyword.t) ::
  :ok |
  no_return

Executes migration commands.

Options

  • :timeout - The time in milliseconds to wait for the query call to finish, :infinity will wait indefinitely (default: 15000);
  • :pool_timeout - The time in milliseconds to wait for calls to the pool to finish, :infinity will wait indefinitely (default: 5000);
  • :log - When false, does not log begin/commit/rollback queries
Link to this callback lock_for_migrations(repo, query, options, function) View Source
lock_for_migrations(repo :: Ecto.Repo.t, query :: Ecto.Query.t, options :: Keyword.t, ([version :: integer] -> result)) :: result when result: var

The callback responsible for locking the migrations table and emitting the locked versions for callback execution.

It returns the result of calling the given function with a list of versions.

Link to this callback supports_ddl_transaction?() View Source
supports_ddl_transaction?() :: boolean

Checks if the adapter supports ddl transaction.