PhoenixKit.Migrations.Postgres.V27 (phoenix_kit v1.7.71)

Copy Markdown View Source

Migration V27: Add Oban tables for background job processing.

This migration creates Oban tables required for background job processing, including file processing (storage system) and email handling.

Changes

  • Creates oban_jobs table for job queue management
  • Creates oban_peers table for distributed coordination
  • Adds indexes for efficient job processing
  • Sets up Oban schema to latest version (uses Oban.Migration.up/1)

Requirements

  • PostgreSQL database
  • Oban dependency ({:oban, "~> 2.17"})

Purpose

  • Enable background job processing for:
    • File variant generation (thumbnails, resizes)
    • Video processing (transcoding, thumbnails)
    • Email sending and tracking
    • Metadata extraction (dimensions, duration, EXIF)
    • Multi-bucket redundancy uploads

Queue Configuration

After running this migration, configure Oban queues in config/config.exs:

config :phoenix_kit, Oban,
  repo: MyApp.Repo,
  queues: [
    default: 10,
    emails: 50,
    file_processing: 20
  ],
  plugins: [Oban.Plugins.Pruner]

Notes

  • Oban tables are created in the same schema prefix as PhoenixKit tables
  • Uses Oban's latest schema version automatically (forward-compatible)
  • Idempotent: Safe to run multiple times

Summary

Functions

down(opts)

up(opts)