Skip to content

Enhance load schema with filtering#663

Merged
morgo merged 3 commits into
block:mainfrom
morgo:enhance-load-schema-from-db
Mar 17, 2026
Merged

Enhance load schema with filtering#663
morgo merged 3 commits into
block:mainfrom
morgo:enhance-load-schema-from-db

Conversation

@morgo
Copy link
Copy Markdown
Collaborator

@morgo morgo commented Mar 17, 2026

A Pull Request should be associated with an Issue.

We wish to have discussions in Issues. A single issue may be targeted by multiple PRs.
If you're offering a new feature or fixing anything, we'd like to know beforehand in Issues,
and potentially we'll be able to point development in a particular direction.
Further notes in https://github.com/block/spirit/blob/main/.github/CONTRIBUTING.md

This adds optional filtering to the LoadSchemaFromDB API. We are always filtering out the same things in our downstream API usage, so it makes sense to push it into here.

Copy link
Copy Markdown
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

Adds optional filtering and normalization capabilities to pkg/table’s schema loader so callers can exclude internal/archived tables and remove volatile AUTO_INCREMENT table options when retrieving SHOW CREATE TABLE output.

Changes:

  • Introduces FilterOptions to control underscore-table exclusion, archive-table exclusion, and AUTO_INCREMENT stripping.
  • Updates LoadSchemaFromDB to accept optional filtering/transform behavior via variadic options.
  • Adds integration tests covering each filter/transform option and a combined scenario.

Reviewed changes

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

File Description
pkg/table/table_schema.go Adds filter options, regex helpers, and applies filtering/DDL transformation during schema load.
pkg/table/table_schema_test.go Adds MySQL-backed tests to validate filtering and AUTO_INCREMENT stripping behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/table/table_schema.go Outdated
Comment thread pkg/table/table_schema.go
Comment thread pkg/table/table_schema.go Outdated
Comment thread pkg/table/table_schema.go
Comment thread pkg/table/table_schema_test.go Outdated
@morgo morgo enabled auto-merge March 17, 2026 14:17
@morgo morgo merged commit 5c4181a into block:main Mar 17, 2026
10 of 11 checks passed
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.

3 participants