Creates and drops the claims table. Call it from one of your migrations:
defmodule MyApp.Repo.Migrations.AddPeriodicalClaims do
use Ecto.Migration
def up, do: PeriodicalEcto.Migration.up()
def down, do: PeriodicalEcto.Migration.down()
endBoth take :table and :prefix, matching the coordinator's options when
those are not the defaults:
def up, do: PeriodicalEcto.Migration.up(table: "scheduler_claims", prefix: "ops")The table:
| Column | Type | Purpose |
|---|---|---|
key | varchar(64), primary key | Periodical.Coordinator.key/1 of the schedule name |
name | varchar(255) | The schedule name, for people reading the table |
token | varchar(64) | The claim holding the lease |
scheduled_at | UTC timestamp, microseconds | The occurrence the holder claimed |
expires_at | UTC timestamp, microseconds, indexed | When the lease ends, by the database clock |