You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: move ignore rules from .pgschemaignore to pgschema.toml - #713
pgschema.toml becomes the project configuration file, loaded from the current directory by dump, plan and apply. Ignore rules move into its [ignore] table, and .pgschemaignore is removed. More config blocks will follow in later PRs.
.pgschemaignore is no longer read. To migrate, move each section into a key under [ignore] and delete the old file:
.pgschemaignore (before)
pgschema.toml (after)
[tables] patterns = ["temp_*"]
[ignore] tables = ["temp_*"]
Pattern syntax and matching are unchanged.
A leftover .pgschemaignore is a hard error with a migration hint, not a silent skip: skipping it would turn every previously ignored object into a planned change (including drops). The error also fires when a pgschema.toml sits next to it.
Changes
cmd/util/config.go replaces ignoreloader.go. util.LoadConfig() returns a Config whose Ignore field is the existing ir.IgnoreConfig, so the 13 per-type wrapper structs are gone. A new block is one more field on Config.
A half-migrated file fails instead of loading with nothing ignored: [tables] patterns = [...] at the top level is an unknown key, and [ignore.tables] is a type error. Unknown keys are rejected as before. Load errors link to the docs page.
Error hints in internal/diff/partition_index.go and internal/postgres/{embedded,external}.go name the new location.
Docs: docs/cli/ignore.mdx is rewritten with a "Migrating from .pgschemaignore" section and keeps its /cli/ignore URL. The dump, plan, apply and plan-db pages, the two comparison blog posts, and CLAUDE.md are updated to the new format.
There is no --config flag; the file is read from the current directory only, as .pgschemaignore was.
Test plan
go test ./... passes locally (all packages, embedded Postgres)
cmd/util/config_test.go covers the [ignore] table, missing and empty files, invalid TOML, unknown keys, both half-migrated shapes, and the leftover .pgschemaignore error
Existing ignore integration tests (TestIgnore*, partition index ignore tests, dump permission suite) now write pgschema.toml
Built the CLI and confirmed pgschema dump exits with the migration error when a .pgschemaignore is present
pgschema.toml is the project configuration file, loaded from the current
directory by dump, plan and apply. Ignore rules are its [ignore] table,
with one key per object type:
[ignore]
tables = ["temp_*", "!temp_core_*"]
privileges = ["deploy_bot"]
The table decodes straight into ir.IgnoreConfig, so the per-type wrapper
structs of the old loader are gone. A later config block is one more
field on util.Config. Pattern syntax and matching are unchanged.
.pgschemaignore is no longer read. A leftover file is a hard error with
a migration hint rather than being skipped: skipping it would turn every
previously ignored object into a planned change. A file renamed without
rewriting its sections ([tables] patterns = [...] or [ignore.tables])
also fails, as do unknown keys.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The legacy-file guard silently treats all os.Stat errors as absence, allowing symlink issues to bypass migration checks and potentially omit ignore rules that protect objects from planned drops.
This PR introduces pgschema.toml as pgschema’s project configuration file, moving ignore rules into [ignore] while preserving pattern matching behavior.
Changes:
Replaces the standalone ignore loader with shared configuration loading for dump, plan, and apply.
Rejects legacy files and invalid configuration shapes with migration guidance.
Updates tests, documentation, and error hints to use the new format.
The legacy-file guard used os.Stat and read every error as "no legacy
file". A dangling .pgschemaignore symlink, a symlink loop, or a
permission error on its target then let the command run without the
ignore rules.
Use os.Lstat so the entry itself is what counts, and return any lookup
error other than "not found".
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The ignore page opens with a breaking-change warning that names 1.x as
the last line to read .pgschemaignore and 2.0.0 as the release that
removes it. The CLI error for a leftover file names the version too.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
A broken pgschema.toml symlink silently disables ignore rules instead of producing a load error, potentially exposing unmanaged objects to planned drops after migration.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Reject dangling pgschema.toml symlinks
cmd/util/config.go:66
A dangling pgschema.toml symlink is treated as a missing optional file: os.Stat returns ENOENT, so the loader succeeds with Ignore == nil. After migration, when .pgschemaignore has been deleted, losing the symlink target therefore silently disables all ignore rules and can expose unmanaged objects to planned drops. Use os.Lstat for this existence check so an existing but broken config symlink reaches DecodeFile and produces a load error.
os.Stat reports a symlink with a missing target as "not found", so the
loader took it for an absent optional file and returned an empty config
with nothing ignored.
Check the entry with os.Lstat instead. A dangling symlink then reaches
the decode step and fails there with the file path.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pgschema.tomlbecomes the project configuration file, loaded from the current directory bydump,planandapply. Ignore rules move into its[ignore]table, and.pgschemaignoreis removed. More config blocks will follow in later PRs.Breaking change
.pgschemaignoreis no longer read. To migrate, move each section into a key under[ignore]and delete the old file:.pgschemaignore(before)pgschema.toml(after)[tables]patterns = ["temp_*"][ignore]tables = ["temp_*"]Pattern syntax and matching are unchanged.
A leftover
.pgschemaignoreis a hard error with a migration hint, not a silent skip: skipping it would turn every previously ignored object into a planned change (including drops). The error also fires when apgschema.tomlsits next to it.Changes
cmd/util/config.goreplacesignoreloader.go.util.LoadConfig()returns aConfigwhoseIgnorefield is the existingir.IgnoreConfig, so the 13 per-type wrapper structs are gone. A new block is one more field onConfig.[tables] patterns = [...]at the top level is an unknown key, and[ignore.tables]is a type error. Unknown keys are rejected as before. Load errors link to the docs page.internal/diff/partition_index.goandinternal/postgres/{embedded,external}.goname the new location.docs/cli/ignore.mdxis rewritten with a "Migrating from .pgschemaignore" section and keeps its/cli/ignoreURL. The dump, plan, apply and plan-db pages, the two comparison blog posts, andCLAUDE.mdare updated to the new format.--configflag; the file is read from the current directory only, as.pgschemaignorewas.Test plan
go test ./...passes locally (all packages, embedded Postgres)cmd/util/config_test.gocovers the[ignore]table, missing and empty files, invalid TOML, unknown keys, both half-migrated shapes, and the leftover.pgschemaignoreerrorTestIgnore*, partition index ignore tests, dump permission suite) now writepgschema.tomlpgschema dumpexits with the migration error when a.pgschemaignoreis present🤖 Generated with Claude Code