跳转到主要内容

pg_statecharts_dev

SCXML import and migration tooling for pg_statecharts

pg_statecharts : SCXML import and migration tooling for pg_statecharts

Overview

ID Extension Package Version Category License Language
2696 pg_statecharts_dev pg_statecharts 0.1.0 FEAT MIT SQL
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
----d-- No No No Yes no no
Relationships
Schemas fsm
Requires pg_statecharts
Siblings pg_statecharts
Development tooling; server file privileges

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT PIGSTY 0.1.0 19 18 17 16 15 pg_statecharts pg_statecharts
RPM PIGSTY 0.1.0 19 18 17 16 15 pg_statecharts_dev_$v pg_statecharts_$v
DEB PIGSTY 0.1.0 19 18 17 16 15 postgresql-$v-pg-statecharts-dev postgresql-$v-pg-statecharts
Linux / PG PG19 PG18 PG17 PG16 PG15
el8.x86_64 N/A PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A
el8.aarch64 N/A PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A
el9.x86_64 MISS PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A
el9.aarch64 MISS PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A
el10.x86_64 MISS PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A
el10.aarch64 MISS PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A
d12.x86_64 MISS PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A
d12.aarch64 MISS PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A
d13.x86_64 MISS PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A
d13.aarch64 MISS PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A
u22.x86_64 MISS PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A
u22.aarch64 MISS PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A
u24.x86_64 MISS PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A
u24.aarch64 MISS PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A
u26.x86_64 MISS PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A
u26.aarch64 MISS PIGSTY 0.1.0 PIGSTY 0.1.0 PIGSTY 0.1.0 N/A

Source

pig build pkg pg_statecharts;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_statecharts;		# install via package name, for the active PG version
pig install pg_statecharts_dev;		# install by extension name, for the current active PG version

pig install pg_statecharts_dev -v 19;   # install for PG 19
pig install pg_statecharts_dev -v 18;   # install for PG 18
pig install pg_statecharts_dev -v 17;   # install for PG 17
pig install pg_statecharts_dev -v 16;   # install for PG 16

Create this extension with:

CREATE EXTENSION pg_statecharts_dev CASCADE; -- requires pg_statecharts

Usage

Sources:

pg_statecharts_dev 0.1.0 is the development companion to pg_statecharts. It imports SCXML definitions and generates Sqitch migrations. The production state-machine runtime does not need this file-access tooling.

Core Workflow

After installing the runtime and its dependency, enable the companion:

CREATE EXTENSION pg_statecharts_dev;
SELECT * FROM fsm.import_scxml_files(
  source_path => '/repo/statecharts',
  recursive => false,
  on_conflict_do_nothing => false
);

The source directory is on the database host. Statechart callbacks must exist with the expected signatures. Parse or validation failures roll back the import transaction instead of accepting part of a chart.

Migration Generation

SELECT fsm.gen_statechart_sqitch_migrations(
  source_path => '/repo/statecharts',
  sqitch_plan_file_path => '/repo/sqitch/sqitch.plan',
  recursive => false
);

Create the destination directories before generation and make them accessible to the database OS user. The generator writes deploy, revert and verify scripts, updates the plan, and can overwrite existing generated chart files. Review the changes before using them as application migrations.

Permissions and Boundaries

Server file reads require pg_read_server_files; writes require pg_write_server_files. These are broad privileges, not a sandbox restricted to the supplied path. Restrict the extension and roles to a controlled development database. It shares the fsm schema, is pure SQL and requires no preload; PostgreSQL 16–18 are the documented test targets.

Use the runtime’s current semantic-version helpers in generated migrations. For old migrations that cast to the removed semver type, follow the upstream migration guide; regenerating every historical chart can introduce callback-order failures. Deploy reviewed generated SQL to production without installing this companion there.

表格阅读