Migration testing
Testing migrations against production-compatible tables, indexes, and constraints without exposing production rows.
Neon · Const
A schema-only branch copies a source branch's database structure without its row data. It is useful for safe development and testing with sensitive datasets.
A schema-only branch copies the database structure from a source branch without copying its rows. It is an independent root branch, so it has no parent or shared data history; you can then add synthetic or test data separately.
neon branches create --name <name> --parent <parent-branch> --schema-only| Name | Type | Description |
|---|---|---|
neon branches create [options] | CLI command | Branch name and creation options, including the source parent and schema-only flag. |
parent_id | string | The source branch whose schema is copied when using the API. |
init_source | string | Selects schema-only initialization in the API request. |
A new Neon root branch containing the source schema without the source branch's row data.
neon branches create --name test-schema --parent main --schema-onlyCreates a schema-only branch from the main branch using the Neon CLI.
Testing migrations against production-compatible tables, indexes, and constraints without exposing production rows.
Creating a safe environment that developers can populate with synthetic or anonymized records.
Building isolated test fixtures from a known schema before running application tests.
A schema-only branch copies the source branch's schema but not its row data. This supports development and testing against production structure without exposing confidential records.
Follow-up: How does it differ from an ordinary branch? An ordinary branch can share the parent's data history, whereas a schema-only branch is an independent root with no parent.
Schema-only branches are root branches with no parent branch and no shared history. Data later added to them is independent and contributes to storage usage.
Follow-up: What does this imply for reset-from-parent? That operation is unavailable because the branch has no parent relationship to reset from.
The CLI supports creation with the --schema-only option, while the API uses init_source set to schema-only. Both approaches create a branch containing the selected source schema without its data.
Follow-up: What API inputs are needed? The documented request requires a project_id and the parent_id of the branch whose schema is copied.
Neon branchesneon branches createinit_sourceparent_idschema-diff