Ramal.Storage.Postgres (Ramal v0.2.0)

Copy Markdown View Source

Keeps branches in the ramal_branches table of the host's Postgres, so they survive a restart.

Add the table with mix ramal.gen.migration, give the supervisor the repo, and nothing else changes:

{Ramal.Supervisor, storage: Ramal.Storage.Postgres, repo: MyApp.Repo}

One row per branch: id (uuid), domain, name, status, inserted_at and updated_at as columns, and the rest in state (jsonb) as Ramal.Storage.Codec writes it. Branch ids are UUIDs, as Ramal.Branch.new/2 makes them. The branch process calls this module from its own process, so the repo's pool serves it like any other caller. The module exists only when Ecto SQL is a dependency of the host.

Example

iex> Ramal.Storage.Postgres.table()
"ramal_branches"

Summary

Functions

The name of the table mix ramal.gen.migration creates.

Functions

table()

@spec table() :: String.t()

The name of the table mix ramal.gen.migration creates.

Example

iex> Ramal.Storage.Postgres.table()
"ramal_branches"