hindsight-postgresql-projections
Copyright(c) 2024
LicenseBSD3
Maintainermaintainer@example.com
Stabilityexperimental
Safe HaskellNone
LanguageGHC2021

Hindsight.Projection.Schema

Description

This module provides the schema initialization for async projections.

The schema is compatible with (and can coexist with) the sync projection schema from hindsight-postgresql-store. Both use the same projections table, but async projections additionally create a NOTIFY trigger for efficient event waiting.

Idempotency

All schema operations use 'CREATE IF NOT EXISTS' and 'CREATE OR REPLACE', making them safe to run multiple times and alongside other projection systems.

Migration Path

  • Sync → Async: NOTIFY trigger gets added automatically
  • Async → Sync: Trigger remains (harmless), or can be dropped manually
  • Both: They share the table harmoniously
Synopsis

Documentation

createProjectionSchema :: Session () Source #

Creates the projection state schema

This creates the projections table and the LISTEN/NOTIFY trigger for async projection progress notifications.

Safe to call multiple times (idempotent). Safe to call alongside hindsight-postgresql-store schema (compatible).