Skip to content

Internal schema

All tool state lives in a dedicated _smplcty_schema_flow PostgreSQL schema, completely separate from user objects. User-defined objects go into whatever schema you configure via pgSchema (default: public).

File tracking table. Records which schema files have been applied per managed pgSchema — a single database can manage multiple pgSchemas independently without their file-hash entries clobbering each other.

Column Type Description
file_path text Relative path to the schema file (part of composite PK)
pg_schema text The managed pgSchema this entry applies to (part of composite PK)
file_hash text SHA-256 hash of file contents
phase text pre, schema, or post
applied_at timestamptz When the file was last applied

A file is re-run only when its hash changes for the same pgSchema. There is no one-shot vs. repeatable distinction. On first run after upgrading from a pre-pgSchema-aware version, the column is added in place and existing rows back-fill to pg_schema = 'public'.

Tracks in-progress expand/contract column migrations. Carries a pg_schema column so backfills scoped to one managed schema don’t pick up state belonging to another.

Stores migration snapshots for rollback. Each snapshot is keyed on its pg_schema value, so runDown only sees snapshots that belong to the schema it was invoked against.

  • No collisions – Tool tables never conflict with user-defined objects, even if you have a table named history or snapshots
  • Clean uninstallDROP SCHEMA _smplcty_schema_flow CASCADE removes all tool state without touching user data
  • Clear ownership_smplcty_schema_flow.* is always tool-managed; everything in the user’s schema is their declared state

The schema is created automatically on first run:

CREATE SCHEMA IF NOT EXISTS _smplcty_schema_flow;

This happens in phase 0, before any other operations.