SchemaSmith Documentation

Product Definition — PostgreSQL (Enterprise)

Define targets, templates, and entry points for multi-environment Postgres deployments.

Product JSON

Overview

Product.json is the entry point for a schema package on PostgreSQL. For the full field reference, validation script chain, template ordering rules, and version stamp behavior that apply across all platforms, see Products & Templates.

PostgreSQL Enterprise shares the same Product.json fields as all Enterprise platforms. This page shows the PostgreSQL-specific validation pattern and example configuration.

PostgreSQL Example

From the SchemaSmith PostgreSQL Enterprise Demos, a product with product-level script folders:

{
  "Name": "ValidProduct",
  "ValidationScript": "SELECT CAST(CASE WHEN EXISTS(SELECT * FROM pg_database WHERE datistemplate = false AND datname = '{{MainDB}}') THEN 1 ELSE 0 END AS BIT)",
  "TemplateOrder": ["Main", "Secondary", "Bogus"],
  "ScriptFolders": [
    { "FolderPath": "Jobs", "QuenchSlot": "After" }
  ],
  "ScriptTokens": {
    "SecondaryDB": "TestSecondary",
    "MainDB": "TestMain",
    "ReleaseVersion": "1.0.1.14",
    "TestQueryToken": "<*Query*>SELECT STRING_AGG(datname, ',') FROM pg_database WHERE datistemplate = false AND datname = '{{MainDB}}'"
  }
}

PostgreSQL Validation

PostgreSQL products validate against pg_database with datistemplate = false to exclude system template databases. The result must be a single row with a value that compares equal to 1 (BIT, INT, or any compatible type). Token references like {{MainDB}} are resolved from script tokens before execution.