Search by

endurance / workout-postgresql

endurance

Atomic PostgreSQL publication and immutable Workout revision storage

Package info

github.com/youmad/endurance-workout-postgresql

pkg:composer/endurance/workout-postgresql

Statistics

Installs: 11

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.2.0 2026-11-23 20:54 UTC

This package is auto-updated.

Last update: 2026-11-23 20:58:06 UTC


README

Doctrine DBAL storage for immutable Workout plans/revisions. Requires PHP 8.5, PostgreSQL 18, PDO pgsql and Doctrine DBAL ^4.4.

composer require endurance/workout-postgresql

Register migrations/ under namespace Endurance\WorkoutPostgresql\Migrations in your migration runner and apply it before use. No automatic schema creation; retained publication history prevents destructive rollback.

use Endurance\Foundation\Clock\SystemClock;
use Endurance\Workout\Application\UseCase\PublishWorkout;
use Endurance\WorkoutPostgresql\DoctrineDbalWorkoutRepository;

$workouts = new DoctrineDbalWorkoutRepository($connection);
$publisher = new PublishWorkout($workouts, new SystemClock());
$plan = $publisher->create($workoutId, $revisionId, $prescription);
$revision = $workouts->getRevision($plan->reference());
  • Storage is unscoped; the application authorizes access. Revision references identify exact immutable content, including retained history.
  • Publication atomically checks both expected head fields and never reuses a stored revision ID. Use the same DBAL connection for shared transactions. A nested commit is not durable until the outer transaction commits; reconcile uncertain responses with the original IDs.
  • Persistence retains exact float bits and repeat counts without expansion. The versioned storage encoding is private to this adapter.

Types in Internal and elements marked @internal are not public API.

License: MPL-2.0.