Skip to content

Comments

feat: .pgschemaignore#28

Merged
tianzhou merged 1 commit intomainfrom
ignore
Sep 15, 2025
Merged

feat: .pgschemaignore#28
tianzhou merged 1 commit intomainfrom
ignore

Conversation

@tianzhou
Copy link
Contributor

Fixing #24

Copilot AI review requested due to automatic review settings September 15, 2025 17:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements support for .pgschemaignore files, allowing users to exclude specific database objects from pgschema operations. It addresses issue #24 by adding a comprehensive ignore system that supports wildcard patterns and negation rules for selective schema management.

  • Adds a new internal/ignore package with TOML-based configuration support
  • Integrates ignore functionality across dump, plan, and apply commands
  • Updates IR parser and inspector to respect ignore patterns during schema analysis

Reviewed Changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/ignore/ignore.go Core ignore functionality with pattern matching logic
internal/ignore/loader.go TOML configuration file loading and parsing
internal/ir/parser.go Updated to accept and use ignore configuration
internal/ir/inspector.go Database inspection now respects ignore patterns
cmd/plan/plan.go Loads ignore config for plan generation
cmd/dump/dump.go Integrates ignore functionality into dump command
go.mod Adds BurntSushi/toml dependency for TOML parsing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@@ -38,7 +38,7 @@ func discoverTestDataVersions(testdataDir string) ([]string, error) {

// parseSQL is a helper function to convert SQL string to IR for tests
func parseSQL(t *testing.T, sql string) *ir.IR {
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The NewParser function now requires two parameters (defaultSchema and ignoreConfig), but this call passes nil for ignoreConfig. Consider using a more explicit parameter name or adding a comment to clarify that nil means no ignore configuration will be applied.

Suggested change
func parseSQL(t *testing.T, sql string) *ir.IR {
func parseSQL(t *testing.T, sql string) *ir.IR {
// Pass nil for ignoreConfig to indicate no ignore configuration will be applied.

Copilot uses AI. Check for mistakes.
Comment on lines +120 to 129
func NewParser(defaultSchema string, ignoreConfig *ignore.IgnoreConfig) *Parser {
if defaultSchema == "" {
defaultSchema = "public"
}
return &Parser{
schema: NewIR(),
defaultSchema: defaultSchema,
ignoreConfig: ignoreConfig,
}
}
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking API change. The NewParser function signature has changed from no parameters to requiring two parameters. All existing callers need to be updated to provide both defaultSchema and ignoreConfig parameters.

Copilot uses AI. Check for mistakes.
Comment on lines +26 to 32
func NewInspector(db *sql.DB, ignoreConfig *ignore.IgnoreConfig) *Inspector {
return &Inspector{
db: db,
queries: queries.New(db),
db: db,
queries: queries.New(db),
ignoreConfig: ignoreConfig,
}
}
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also a breaking API change. The NewInspector function signature has changed from one parameter to two parameters. All existing callers must be updated to provide the ignoreConfig parameter.

Copilot uses AI. Check for mistakes.
@tianzhou tianzhou merged commit cb57600 into main Sep 15, 2025
2 checks passed
@tianzhou tianzhou deleted the ignore branch October 23, 2025 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant