# `PhoenixReplay.Storage.Ecto`
[🔗](https://github.com/elixir-vibe/phoenix_replay/blob/v0.6.2/lib/phoenix_replay/storage/ecto.ex#L2)

Stores recordings in a database table through an Ecto repo.

Summary columns are stored alongside the encoded recording so listing
never decodes recordings. `event_names` holds the summary's event names
in the same encoding as `data`, and the `phoenix_replay_marks` table
the moments each recording reached, so SQL can filter and count them.

The dashboard's pages are read in SQL, except when filtering by text or
event name: event names are stored encoded, so those criteria are
checked after reading the rows matching the others.

Tested on PostgreSQL, SQLite (ecto_sqlite3) and DuckDB (QuackDB). MySQL
is not supported: saving upserts on `id`, and Ecto cannot name a
conflict target there.

## Options

  * `:repo` — the Ecto repo module (required)

## Migration

Create the table with `PhoenixReplay.Storage.Ecto.Migration`, which also
upgrades tables made by earlier releases:

    defmodule MyApp.Repo.Migrations.AddPhoenixReplay do
      use Ecto.Migration

      def up, do: PhoenixReplay.Storage.Ecto.Migration.up(version: 3)
      def down, do: PhoenixReplay.Storage.Ecto.Migration.down(version: 3)
    end

---

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