Creates and upgrades the table PhoenixReplay.Storage.Ecto stores
recordings in.
Call it from a migration in your application:
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)
endPin the version, so the migration does the same thing after later releases add versions. The table is versioned, and each PhoenixReplay release that changes it adds a version:
- the table PhoenixReplay 0.4 created
error_count,tab,viewport,deviceandsource, which the dashboard lists and filters by, andsaved_at, which keeps its pages in placemedium,campaign,device_type,browserandrelease, and thephoenix_replay_markstable of the moments each session reached, all of which the dashboard filters by, and an index onview. Rows saved earlier get their source split into source, medium and campaign, and their device type from their viewport; their browser stays empty.
up/1 runs every version after :from (default 0), up to
:version (default the latest); down/1 reverses them. A table made by
an earlier release is upgraded with a new migration:
def up, do: PhoenixReplay.Storage.Ecto.Migration.up(from: 2, version: 3)
def down, do: PhoenixReplay.Storage.Ecto.Migration.down(from: 2, version: 3)The module is a migration itself, creating the latest table, so tools
such as Ecto.Migrator.run/4 can run it directly.
Summary
Functions
@spec down(keyword()) :: :ok
Reverses the versions up/1 with the same options runs.
@spec latest() :: pos_integer()
The latest version of the table.
@spec up(keyword()) :: :ok
Runs the versions after :from, up to :version.