Repository navigation
feat!: a column dependency says how it is read, an altered column what was altered - #197
Merged
Merged
Conversation
…t was altered Dependency.Column has a ColumnRole: a key by itself, in an expression, in the condition, an included column. The resolver says the first two and SqlFragment.As the others. BaseChange.ColumnAltered has a ColumnAlteration read from the operation's two sides: the type, the nullability, the default, the collation, or something else. The PostgreSQL package answers ImpactOf from one table, PgImpact, keyed by the object's kind, the column's role and the change. The exclusion contributor writes no answer of its own and gives the ones it gave. ImpactOf stays mandatory; the kernel has no table and no default. The second provider's SQL Server probe answers from both: a default and a change of nullability leave an index where it is, unless its filter reads the column. Closes #117 Co-Authored-By: Claude Fable 5.2 <[email protected]>
CaffeinatedCoder
enabled auto-merge
November 25, 2026 15:17
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.
Closes #117
Decided 2026-11-25 with #116.
Problem
ImpactOfasks each contributor what the database does to its object when a column or a table changes. Two things the contract could not say: how an object reads a column, which the exclusion contributor kept beside its descriptor (#102), and what anAlterColumnOperationaltered, so that on SQL Server a default or a change of nullability took an index away and built it again for nothing (#119). And a second PostgreSQL contributor would write PostgreSQL's answers a second time.Change
Dependency.Column(Table, Name, Role)withColumnRole:Key,Expression,Condition,Included. The resolver saysKeyfor a column by itself andExpressionfor one in a template;SqlFragment.As(role)says the others where a contributor puts a fragment. Read in two ways, a column is two dependencies. The role has a default,Key, so a dependency made by hand reads as before.BaseChange.ColumnAltered(Table, Column, What)withColumnAlteration, flags read from the operation's two sides:Type(a length, precision, scale, character set and fixed length are part of it),Nullability,Default,Collation, andOther, which is what is left and never nothing.PgImpact, the PostgreSQL package's one table, keyed by the object's kind, the column's role and the change.PgExclusionContributor.ImpactOfis one line that reads it, and the descriptor'sKeyColumnsis gone. Its answers are the ones it gave: every test ofPgExclusionMigrationTestsandPgExclusionLiveTestspasses unchanged.EnsureCreated()builds.ImpactOfis mandatory as before, and the kernel has no table and no default.Not held by a behaviour: that
PgExclusionContributorreads its condition's columns asConditionand not asExpression. PostgreSQL answers both alike for an exclusion constraint, so no migration differs.The_packages_table_answers_a_dropped_column_by_the_way_it_is_readholds the table's rows for each role; the role the contributor states for the condition matters first withPgIndex(#27), whose predicate PostgreSQL treats otherwise.Tests
Offline: 772 (kernel), 200 (PostgreSQL package), 90 (second provider); the API probes: 127. Live: 4 and 76 on PostgreSQL 16 and on 18, 86 on SQL Server 2022. The consumer smoke test: 47 rows. The live suites, the probes and the smoke test ran before the last test was added; nothing under
src/changed after them.Thirteen rules were changed in turn, each run with the live tests on PostgreSQL 18 and SQL Server 2022. A test failed for twelve:
Aschanges no roleA_fragment_composed_of_others_reads_what_they_read, 12 of the second provider'sA_dropped_column_that_is_an_element_takes_the_constraint_with_it_whatever_else_reads_itA_filter_of_5x_may_read_a_column_it_does_not_name_by_a_pathAn_altered_column_says_what_was_altered, two of the second provider'sAn_altered_column_says_what_was_alteredbreaking:Dependency.ColumnandBaseChange.ColumnAlteredeach have a new member, in the contract (SK9001).🤖 Generated with Claude Code