PhoenixReplay.Storage.Ecto (PhoenixReplay v0.2.0)

Copy Markdown View Source

Ecto-based storage backend. Stores recordings in a database table.

Requires ecto_sql as a dependency of the host application.

Options

  • :repo — the Ecto repo module (required)
  • :format:etf (default) or :json — controls the serialization format of the data column

Migration

Create the table with:

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

  def change do
    create table(:phoenix_replay_recordings, primary_key: false) do
      add :id, :string, primary_key: true
      add :view, :string, null: false
      add :connected_at, :bigint, null: false
      add :event_count, :integer, null: false, default: 0
      add :data, :binary, null: false

      timestamps(type: :utc_datetime)
    end
  end
end