Skip to content

Concepts, installation and metadata schema

Purpose

Strates stores immutable business snapshots. Every version receives a UUID v7 buildStrate. Releasing a version updates one row in released_strates; business rows are not rewritten.

Core concepts:

  • scope: logical aggregate type, for example catalog or booking;
  • scope id: aggregate identifier, for example one shop or booking;
  • build strate: UUID v7 identifying one snapshot build;
  • root manager: manager used by released-data queries;
  • release pointer: active strate for one (scope, scopeId) pair.

Compatibility and installation

composer require small/swoole-entity-manager-strates

The supplied package requires:

PHP >= 8.3
small/swoole-entity-manager-core ~2.7.0

Install metadata tables

MySQL:

mysql app < vendor/small/swoole-entity-manager-strates/schema/mysql.sql

PostgreSQL:

psql app < vendor/small/swoole-entity-manager-strates/schema/postgres.sql

The package creates two metadata tables:

  • stratified_build: one row per build with status and timestamps;
  • released_strates: one unique release pointer per (scope, scope_id).

Build states are:

  • building;
  • released;
  • failed;
  • garbage_collected.

The metadata managers use the ORM default connection. Business managers involved in a release must resolve to the same database connection.

Next chapter: Stratified entities and configuration