feat: add validation for file extensions in apply command#434
Merged
tianzhou merged 1 commit intoMay 30, 2026
Conversation
Greptile SummaryThis PR adds early file-extension validation to the apply command. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (1): Last reviewed commit: "feat: add validation for file extensions..." | Re-trigger Greptile |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds early validation in the apply command to detect when a user passes a JSON file to --file or a SQL file to --plan, returning an actionable error suggesting the correct flag.
Changes:
- New
validateFileExtensionhelper incmd/apply/apply.gochecks--file/--planextensions (case-insensitive) and returns a helpful error on mismatch. RunApplyinvokes the new validator after the existing required-flag check.- New unit tests cover both the validator directly and the end-to-end behavior via
RunApply.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cmd/apply/apply.go | Adds validateFileExtension and wires it into RunApply. |
| cmd/apply/apply_test.go | Adds table-driven and scenario tests for the new validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tianzhou
approved these changes
May 30, 2026
Contributor
tianzhou
left a comment
There was a problem hiding this comment.
LGTM. Thanks for the contribution.
NFUChen
added a commit
to NFUChen/pgschema
that referenced
this pull request
Jun 3, 2026
* refactor: refactor the release workflow's test job to use a GitHub Actions matrix strategy, running PostgreSQL 14-18 tests in parallel instead of sequentially. (pgplex#432) * refactor: streamline CI workflows for unit and integration tests with matrix strategy * fix: ensure integration tests depend on unit tests in CI workflow * refactor: consolidate unit and integration tests into a single CI job * revert: undo unnecessary trailing newline change in ci-test.yml --------- Co-authored-by: William Chen <william_w_chen@trendmicro.com> * feat: add validation for file extensions in apply command (pgplex#434) Co-authored-by: William Chen <william_w_chen@trendmicro.com> * Add support for indexes section in .pgschemaignore (pgplex#441) Adds a new [indexes] section to .pgschemaignore that lets users preserve indexes which exist in the database but are not declared in their .sql files. Without this, manually-added indexes (e.g. perf hotfixes) are flagged for drop by `pgschema plan`. Mirrors the existing per-object pattern: `Indexes []string` on `IgnoreConfig` with `ShouldIgnoreIndex(name)`, an `IndexIgnoreConfig` struct on `TomlConfig`, and a filter in `Inspector.buildIndexes` that skips ignored index names before they enter the IR. Fixes pgplex#406 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix: preserve length modifier in varchar(n)[] array columns (pgplex#420) (pgplex#438) Co-authored-by: vytautas.karpavicius <vytautas.karpavicius@cloudkitchens.com> * chore: bump 1.9.0 to 1.10.0 --------- Co-authored-by: William Chen <william_w_chen@trendmicro.com> Co-authored-by: Guillaume Lecomte <guillaume86@gmail.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Vytautas <vycas0@gmail.com> Co-authored-by: vytautas.karpavicius <vytautas.karpavicius@cloudkitchens.com> Co-authored-by: Tianzhou <t@bytebase.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.