Skip to content

Feature/schema fingerprint#3

Merged
Nechja merged 7 commits intomainfrom
feature/schema-fingerprint
Sep 19, 2025
Merged

Feature/schema fingerprint#3
Nechja merged 7 commits intomainfrom
feature/schema-fingerprint

Conversation

@Nechja
Copy link
Copy Markdown
Owner

@Nechja Nechja commented Sep 17, 2025

This pull request introduces a schema fingerprinting feature to the schemalyzer tool, allowing users to quickly generate and compare SHA256 hashes of database schemas for instant change detection. The main changes include new commands, a robust fingerprinting implementation, integration into the CLI, and comprehensive tests to ensure reliability and correctness.

New Commands and CLI Integration:

  • Added fingerprint and compare-fingerprints commands to the CLI, enabling users to generate a schema fingerprint and compare two fingerprints for quick schema change detection. [1] [2] [3]
  • Updated README.md with detailed documentation and usage examples for the new commands, including flags and CI/CD integration patterns.

Fingerprinting Implementation:

  • Implemented the Hasher in internal/fingerprint/hasher.go to normalize schema objects and generate a consistent SHA256 hash, ensuring order independence and ignoring comments for reliable comparisons.

    Functional Testing Results:

    • PostgreSQL fingerprint generation working
    • Deterministic hashing verified (same schema = same hash)
    • Different schemas produce different hashes
    • Compare-fingerprints correctly identifies matches/differences
    • Pre-computed hash comparison working
    • JSON and verbose output formats working
    • Tables-only flag produces different hashes

@Nechja Nechja requested a review from Copilot September 17, 2025 00:18
Copy link
Copy Markdown

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 introduces a schema fingerprinting feature to the schemalyzer tool, enabling users to generate SHA256 hashes of database schemas for instant change detection and quick comparison. The implementation provides deterministic, order-independent hashing while ignoring comments for reliable schema comparisons.

  • Added fingerprint and compare-fingerprints CLI commands with comprehensive flag options
  • Implemented robust schema normalization and hashing logic in the Hasher type
  • Created comprehensive test coverage for fingerprint generation and comparison functionality

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/functional_test.sh Functional test script validating fingerprint generation, deterministic hashing, and comparison features
internal/fingerprint/hasher_test.go Unit tests covering fingerprint generation, determinism, order independence, and comment handling
internal/fingerprint/hasher.go Core fingerprinting implementation with schema normalization and SHA256 hash generation
cmd/schemalyzer/commands/root.go Integration of new fingerprint commands into the CLI
cmd/schemalyzer/commands/fingerprint.go Implementation of the fingerprint command with various output options
cmd/schemalyzer/commands/compare_fingerprints.go Implementation of the compare-fingerprints command for schema comparison
README.md Documentation and usage examples for the new fingerprinting commands

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

Comment thread internal/fingerprint/hasher.go
Comment thread cmd/schemalyzer/commands/compare_fingerprints.go Outdated
@Nechja Nechja requested a review from Copilot September 19, 2025 06:16
Copy link
Copy Markdown

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

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.


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

Comment thread internal/fingerprint/hasher.go Outdated
Comment thread internal/fingerprint/hasher.go Outdated
Comment thread cmd/schemalyzer/commands/root.go
@Nechja Nechja merged commit c4c6dbe into main Sep 19, 2025
7 checks passed
@Nechja Nechja deleted the feature/schema-fingerprint branch October 3, 2025 15:07
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.

2 participants