Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Neon · Const

Schema-only branch

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.

How it works

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.

Syntax

neon branches create --name <name> --parent <parent-branch> --schema-only

Parameters

NameTypeDescription
neon branches create [options]CLI commandBranch name and creation options, including the source parent and schema-only flag.
parent_idstringThe source branch whose schema is copied when using the API.
init_sourcestringSelects schema-only initialization in the API request.

Returns

A new Neon root branch containing the source schema without the source branch's row data.

Key points

  • The branch contains database structure such as tables and related definitions, but source rows are excluded.
  • The resulting branch starts an independent data line rather than inheriting the source branch's parent relationship.
  • Rows inserted later are separate branch data and consume storage independently of the source.
  • Branch-count limits still apply, so creating one does not exempt it from project branch quotas.

Common mistakes

  • A schema-only branch is a root branch, so parent-based operations and assumptions about inherited data history do not apply.

Example: Create a schema-only branch

neon branches create --name test-schema --parent main --schema-only

Creates a schema-only branch from the main branch using the Neon CLI.

When to use it

Migration testing

Testing migrations against production-compatible tables, indexes, and constraints without exposing production rows.

Sensitive-data development

Creating a safe environment that developers can populate with synthetic or anonymized records.

Automated test setup

Building isolated test fixtures from a known schema before running application tests.

Interview questions

QWhat is a schema-only branch, and why use one?

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.

QHow are schema-only branches related to parent branches and storage?

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.

QHow can you create a schema-only branch?

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 branches
  • neon branches create
  • init_source
  • parent_id
  • schema-diff

Source: Schema-only branches - Neon Docs. Checked 2026-10-16.