Ecto.Adapters.Mnesia.Migration (Ecto3 Mnesia v0.3.0) View Source

Functions for dealing with schema migrations

Link to this section Summary

Functions

Returns true if table is stored in RAM

Add a foreign key constraint

Creates table and wait for its creation

Link to this section Types

Specs

access_opt() :: {:access_mode, :read_write | :read_only}

Specs

Specs

create_opts() :: [create_opt()]

Specs

disc_copies_opt() :: {:disc_copies, [node()]}
Link to this type

disc_only_copies_opt()

View Source

Specs

disc_only_copies_opt() :: {:disc_only_copies, [node()]}

Specs

index_opt() :: {:index, [atom()]}

Specs

load_order_opt() :: {:load_order, integer()}

Specs

local_content_opt() :: {:local_content, boolean()}

Specs

majority_opt() :: {:majority, boolean()}

Specs

ram_copies_opt() :: {:ram_copies, [node()]}
Link to this type

storage_properties_opt()

View Source

Specs

storage_properties_opt() :: {:storage_properties, [{atom(), term()}]}

Specs

sync_create_opts() :: [{:timeout, integer()} | create_opts()]

Specs

t() :: {module(), Keyword.t()}

Specs

table() :: atom()

Link to this section Functions

Link to this function

create_table(repo, schema, opts \\ [])

View Source

Specs

create_table(module(), module(), create_opts()) ::
  {:ok, table()} | :ignore | {:error, term()}

Creates mnesia table.

See http://erlang.org/doc/man/mnesia.html#create_table-2 for options, except from the following ones:

  • attributes: ignored, computed from schema
  • index: in addition to primary keys indices
  • record_name: ignored, computed from schema
  • snmp: unsupported
  • type: ignored, all tables are of type set

Returns created table name

Link to this function

drop_table(repo, schema)

View Source

Specs

drop_table(module(), module()) :: :ok | {:error, term()}

Drop table

Returns ok if table has been deleted or did not exist

Returns true if table is stored in RAM

Link to this function

references(from, relation, opts \\ [])

View Source

Specs

references(module(), atom(), Ecto.Adapters.Mnesia.Constraint.ForeignKey.opts()) ::
  :ok | {:error, term()}

Add a foreign key constraint

Link to this function

sync_create_table(repo, schema, opts \\ [])

View Source

Specs

sync_create_table(module(), module(), sync_create_opts()) ::
  :ok | {:error, term()}

Creates table and wait for its creation