# `Ecto.Adapter.Migration`
[🔗](https://github.com/elixir-ecto/ecto_sql/blob/v3.14.0/lib/ecto/adapter/migration.ex#L1)

Specifies the adapter migrations API.

# `adapter_meta`

```elixir
@type adapter_meta() :: Ecto.Adapter.adapter_meta()
```

# `command`

```elixir
@type 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_mode()}
  | {:drop_if_exists, Ecto.Migration.Table.t(), drop_mode()}
  | {:create, Ecto.Migration.Index.t()}
  | {:create_if_not_exists, Ecto.Migration.Index.t()}
  | {:drop, Ecto.Migration.Index.t(), drop_mode()}
  | {:drop_if_exists, Ecto.Migration.Index.t(), drop_mode()}
  | {:create, Ecto.Migration.Constraint.t()}
  | {:drop, Ecto.Migration.Constraint.t(), drop_mode()}
  | {:drop_if_exists, Ecto.Migration.Constraint.t(), drop_mode()}
```

All migration commands

# `ddl_object`

```elixir
@type 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.

# `drop_mode`

```elixir
@type drop_mode() :: :restrict | :cascade
```

# `table_subcommand`

```elixir
@type table_subcommand() ::
  {:add, field :: atom(),
   type :: Ecto.Type.t() | Ecto.Migration.Reference.t() | binary(), Keyword.t()}
  | {:add_if_not_exists, field :: atom(),
     type :: Ecto.Type.t() | Ecto.Migration.Reference.t() | binary(),
     Keyword.t()}
  | {:modify, field :: atom(),
     type :: Ecto.Type.t() | Ecto.Migration.Reference.t() | binary(),
     Keyword.t()}
  | {:remove, field :: atom(),
     type :: Ecto.Type.t() | Ecto.Migration.Reference.t() | binary(),
     Keyword.t()}
  | {:remove, field :: atom()}
  | {:remove_if_exists, field :: atom(),
     type :: Ecto.Type.t() | Ecto.Migration.Reference.t() | binary()}
  | {:remove_if_exists, field :: atom()}
```

All commands allowed within the block passed to `table/2`

# `execute_ddl`

```elixir
@callback execute_ddl(adapter_meta(), command(), options :: Keyword.t()) ::
  {:ok, [{Logger.level(), Logger.message(), Logger.metadata()}]}
```

Executes migration commands.

# `lock_for_migrations`

```elixir
@callback lock_for_migrations(adapter_meta(), options :: Keyword.t(), fun) :: result
when fun: (-&gt; 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?`

```elixir
@callback supports_ddl_transaction?() :: boolean()
```

Checks if the adapter supports ddl transaction.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
