Ecto.Adapter.Migration

Ecto.Adapter.Migration behaviour

Specifies the adapter migrations API.

Summary

Types

command()

All migration commands

ddl_object()

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

table_subcommand()

All commands allowed within the block passed to table/2

Callbacks

execute_ddl(repo, command, options)

Executes migration commands

supports_ddl_transaction?()

Checks if the adapter supports ddl transaction

Types

command()

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()

ddl_object() :: Ecto.Migration.Table.t | Ecto.Migration.Index.t

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.

table_subcommand()

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

Callbacks

execute_ddl(repo, command, options)

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

supports_ddl_transaction?()

supports_ddl_transaction?() :: boolean

Checks if the adapter supports ddl transaction.

© 2012 Plataformatec
Licensed under the Apache License, Version 2.0.
https://hexdocs.pm/ecto/Ecto.Adapter.Migration.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部