Ecto SQL v3.1.3 Ecto.Adapter.Migration behaviour View Source
Specifies the adapter migrations API.
Link to this section Summary
Types
All migration commands
A struct that represents a table or index in a database schema.
All commands allowed within the block passed to table/2
Callbacks
Executes migration commands.
Locks the migrations table and emits the locked versions for callback execution.
Checks if the adapter supports ddl transaction.
Link to this section Types
adapter_meta()
View Source
adapter_meta() :: Ecto.Adapter.adapter_meta()
adapter_meta() :: Ecto.Adapter.adapter_meta()
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()}
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
ddl_object()
View Source
ddl_object() :: Ecto.Migration.Table.t() | Ecto.Migration.Index.t()
ddl_object() :: Ecto.Migration.Table.t() | Ecto.Migration.Index.t()
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.
table_subcommand()
View Source
table_subcommand() ::
{:add, field :: atom(), type :: Ecto.Type.t() | Ecto.Migration.Reference.t(),
Keyword.t()}
| {:add_if_not_exists, 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(),
type :: Ecto.Type.t() | Ecto.Migration.Reference.t(), Keyword.t()}
| {:remove, field :: atom()}
| {:remove_if_exists, type :: Ecto.Type.t() | Ecto.Migration.Reference.t()}
table_subcommand() :: {:add, field :: atom(), type :: Ecto.Type.t() | Ecto.Migration.Reference.t(), Keyword.t()} | {:add_if_not_exists, 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(), type :: Ecto.Type.t() | Ecto.Migration.Reference.t(), Keyword.t()} | {:remove, field :: atom()} | {:remove_if_exists, type :: Ecto.Type.t() | Ecto.Migration.Reference.t()}
All commands allowed within the block passed to table/2
Link to this section Callbacks
execute_ddl(adapter_meta, command, options)
View Source
execute_ddl(adapter_meta(), command(), options :: Keyword.t()) ::
{:ok, [{Logger.level(), Logger.message(), Logger.metadata()}]}
execute_ddl(adapter_meta(), command(), options :: Keyword.t()) :: {:ok, [{Logger.level(), Logger.message(), Logger.metadata()}]}
Executes migration commands.
lock_for_migrations(adapter_meta, arg2, options, fun)
View Source
lock_for_migrations(adapter_meta(), Ecto.Query.t(), options :: Keyword.t(), fun) ::
result
when fun: (Ecto.Query.t() -> result), result: var
lock_for_migrations(adapter_meta(), Ecto.Query.t(), options :: Keyword.t(), fun) :: result when fun: (Ecto.Query.t() -> result), result: var
Locks the migrations table and emits the locked versions for callback execution.
It returns the result of calling the given function with a list of versions.
supports_ddl_transaction?()
View Source
supports_ddl_transaction?() :: boolean()
supports_ddl_transaction?() :: boolean()
Checks if the adapter supports ddl transaction.