Pixelex.Migration (Pixelex v0.1.0)

Copy Markdown View Source

Schema, installed from a migration in the host application:

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

  def up, do: Pixelex.Migration.up()
  def down, do: Pixelex.Migration.down()
end

The same shape Oban and error_tracker use: the library owns the DDL, the host owns when it runs.

Why pixelex_events is partitioned from the first migration

Converting a populated table to a partitioned one later means copying every row under an exclusive lock. On the one table that grows fastest, that is the migration nobody ever runs — so the table is born partitioned, even on a site with a hundred events.

Partitions are created by Pixelex.Partitions.ensure/1, which this migration calls for the current and next month. Keeping it running is the host's job; see that module.

Summary

Functions

down()

up()