ecto_mnesia v0.3.0 Ecto.Mnesia.Storage

This module provides interface to manage Mnesia state and records data structure.

Summary

Functions

Creates table secondary indexes

Creates tables and indexes from a Ecto.Mnesia meta-schema

Start the Mnesia database

This is dirty hack for Ecto that is trying to receive child spec from adapter, and we don’t have any workers and supervisors that needs to be added to tree (Mnesia is a separate OTP app)

Stop the Mnesia database

Creates the storage given by options

Functions

create_indexes(meta_schema, table)

Creates table secondary indexes.

create_table(host, table, copy_type, fields)

Creates a table.

migrate_schemas(host, copy_type, meta_schema)

Creates tables and indexes from a Ecto.Mnesia meta-schema.

start()

Start the Mnesia database.

start_link(conn_mod, opts \\ [])

This is dirty hack for Ecto that is trying to receive child spec from adapter, and we don’t have any workers and supervisors that needs to be added to tree (Mnesia is a separate OTP app).

So we simply handle whatever Repo.Supervisor is sending to us and initiating Mnesia tables.

stop()

Stop the Mnesia database.

storage_down(config)

Callback implementation for Ecto.Adapter.Storage.storage_down/1.

storage_up(config)

Creates the storage given by options.

Returns :ok if it was created successfully. Returns {:error, :already_up} if the storage has already been created or {:error, term} in case anything else goes wrong.

Supported copy_type values: :disc_copies, :ram_copies, :disc_only_copies.

Examples

storage_up(host: `Kernel.node`,
           copy_type: :,
           hostname: 'localhost')