Account for derived objects when comparing schemas - #7477
Draft
morozov wants to merge 11 commits into
Draft
Conversation
This was referenced Jul 26, 2026
morozov
force-pushed
the
derived-objects
branch
7 times, most recently
from
August 1, 2026 16:28
88ca687 to
5e42b3d
Compare
morozov
force-pushed
the
derived-objects
branch
from
August 1, 2026 17:39
5e42b3d to
22c0fb3
Compare
A DerivedObject describes, without a name, a schema object a platform creates on its own — an index enforcing a constraint, or a constraint a unique index carries. Each platform's provider says which objects it derives from a table's declared ones.
morozov
force-pushed
the
derived-objects
branch
from
August 1, 2026 18:06
22c0fb3 to
ec51431
Compare
morozov
force-pushed
the
derived-objects
branch
from
August 2, 2026 03:37
ec51431 to
2249ca4
Compare
morozov
force-pushed
the
derived-objects
branch
3 times, most recently
from
August 20, 2026 02:40
bda8c3c to
1138e96
Compare
The comparator asks the platform's provider which objects the database adds to a table, so it can tell them apart from the ones the application declared.
The comparator expects the index the engine creates over a foreign key's referencing columns, so the definition layer no longer mirrors it with an invented one.
Comparing schemas requires telling whether two unique constraints describe the same constraint.
The get*ForAlteredTable() helpers return the objects to create the rebuilt table with.
The method takes how a constraint reports its columns and how it is rebuilt with new ones, so a second kind of constraint can reuse it.
A table diff carries the unique constraints to add and the names of the ones to drop, and each platform renders them.
The method takes how two constraints of a kind compare, so a second kind can reuse it. A constraint that matches no longer goes on being compared with the rest.
The comparator tells the unique constraints of two tables apart, so a table diff carries the ones to add and drop. The method that does it serves the foreign key constraints as well.
Introspection describes what the database has. A table with a primary key or a unique constraint has a unique index over its columns, so the per-platform predicates that withheld it are gone. The comparator expects each such index, so reporting it does not turn a round trip from the database towards the declared schema into a difference.
The comparison from the declared schema to the one the database reports is no longer supported.
morozov
force-pushed
the
derived-objects
branch
from
August 20, 2026 16:12
1138e96 to
d479f2c
Compare
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.
No description provided.