Schema Sync

Pull, push, diff, and compare field and template schemas between ProcessWire sites.

What schema sync does

Schema sync lets you export, import, diff, and compare your ProcessWire field and template definitions between sites. This is useful for keeping development, staging, and production environments in alignment.

Schema files

Schema is stored as two JSON files under .pw-sync/schema/:

  • fields.json: all non-system fields with their type, inputfield, label, description, and type-specific settings.
  • templates.json: all non-system templates with their field list, family settings, access rules, and cache configuration.

These files are portable. You can commit them to version control and use them to provision new environments.

Pull schema

Export the current site's schema to local files:

Pull the site schema.

pw_schema_pull overwrites fields.json and templates.json with the current state. Before overwriting, it creates .bak copies of the existing files so a mistaken pull is recoverable.

Push schema

Apply local schema files to a ProcessWire site:

Push the schema to ProcessWire. Dry-run first.

pw_schema_push reads the local JSON files and creates or updates fields and templates to match. Fields are processed before templates so that template field lists can reference newly created fields.

Schema push is additive: it creates missing fields and templates and updates existing ones, but it never deletes fields or templates. It also does not change a field's type (e.g. from FieldtypeText to FieldtypeTextarea) because that could destroy data.

Diff schema

Compare your local schema files against the live site:

Show me the schema diff.

pw_schema_diff reports fields and templates that exist locally but not in ProcessWire (and vice versa), plus any settings that differ.

Compare two sites

Compare schemas between two environments without modifying either:

Compare the local schema against production.

pw_schema_compare fetches the schema from both sites and reports differences. You can compare current (the locally configured site) against production or any named site configured in .pw-sync/sites/.

Named sites are configured as JSON files (see Configuration).

FieldtypeOptions support

Schema push supports FieldtypeOptions fields. If the local schema defines option values that don't exist on the live site, they are added after the field is saved. Existing options are not removed or reordered.