feat: add ignore_columns to exclude columns from reconciliation#35
feat: add ignore_columns to exclude columns from reconciliation#35mikkeldamsgaard merged 1 commit intomainfrom
Conversation
Columns listed in ignore_columns are included in the initial INSERT but excluded from change detection, UPDATE statements, and content hash computation. Useful for timestamps, tokens, or values managed by database triggers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds an ignore_columns option for reconcile-mode table specs so certain columns are inserted initially but excluded from reconciliation change detection, UPDATE statements, and content-hash based skip logic.
Changes:
- Extend seed schema with
ignore_columnsand add validation (no empty entries, no overlap withunique_key). - Update reconciliation executor to exclude ignored columns from row comparison and UPDATE column sets.
- Update seed-set content hash computation and docs/tests to reflect ignore behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/seed/schema.rs |
Adds ignore_columns to the schema and validates it for reconcile mode; adds schema validation tests. |
src/seed/hash.rs |
Excludes ignored columns from content hash computation; adds a hash test for ignored columns. |
src/seed/executor.rs |
Excludes ignored columns from tracked row comparison and UPDATE generation; adds reconciliation tests around ignored columns. |
docs/seeding.md |
Documents ignore_columns behavior and constraints in reconcile mode. |
CHANGELOG.md |
Notes the new ignore_columns feature in Unreleased. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Ignored columns don't affect the hash — changes to them | ||
| // won't trigger reconciliation. | ||
| if ts.ignore_columns.contains(key) { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
compute_seed_set_hash excludes values for ignored columns, but it does not incorporate the ignore_columns configuration itself into the hash. This means changing ignore_columns (e.g., adding/removing a column) may not change the content hash, causing reconcile mode to incorrectly skip the seed set even though reconciliation semantics and tracked row encoding have changed. Include a deterministic representation of ts.ignore_columns (e.g., JSON of the list, ideally normalized/sorted) in the hash similarly to unique_key so config changes trigger reconciliation.
| if ts.ignore_columns.iter().any(|c| c.trim().is_empty()) { | ||
| return Err(format!( | ||
| "table '{}' in seed_set '{}' has empty or whitespace-only entries in ignore_columns", | ||
| ts.table, ss.name | ||
| )); | ||
| } | ||
| for ic in &ts.ignore_columns { | ||
| if ts.unique_key.contains(ic) { | ||
| return Err(format!( | ||
| "table '{}' in seed_set '{}': column '{}' cannot be in both unique_key and ignore_columns", | ||
| ts.table, ss.name, ic | ||
| )); | ||
| } | ||
| } |
There was a problem hiding this comment.
The ignore_columns validation is currently only executed when ss.is_reconcile() (i.e., mode: reconcile in the spec). However --reconcile-all can force reconciliation for mode: once seed sets, bypassing these new checks (empty/whitespace entries, overlap with unique_key). Consider validating ignore_columns regardless of seed set mode, or adding equivalent validation in the executor’s reconcile-all guard, so invalid configs are consistently rejected whenever reconciliation can run.
Summary
ignore_columnsoption to tables in reconcile modeignore_columnsandunique_key, and rejects empty entriesExample
Test plan
🤖 Generated with Claude Code