# `Ramal.Storage.Postgres`
[🔗](https://github.com/agustinrojas1/ramal/blob/v0.2.0/lib/ramal/storage/postgres.ex#L2)

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"

# `table`

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

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

## Example

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

---

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