Repository navigation
Description
2026-11-25: in PR #196 (feat/195-order-by-dependency). Offline: 771 of the kernel's tests, 199 of the PostgreSQL package's, 90 of the second provider's; the API probes' 127. Live: 4 and 76 on PostgreSQL 16 and on 18, 86 on SQL Server 2022, the consumer smoke test's 47 rows. The live suites, the probes and the smoke test ran before the last two tests were added; nothing under src/ changed after them.
What is there:
Dependency.SchemaObject(Owner, Scope, Name). Which object is needed is the three together, as its descriptor says them.- Within a phase a create comes after the creates of what it needs and a drop before their drops, whatever the placement and the model's order say. What needs nothing keeps the order it had. The model's order is the order of the stored keys, not the one written.
- Refused: objects that need each other in a circle, with their names; an object created before the tables that needs one created after them; and, in the context's own model only, a dependency on an object the model does not declare.
- The kernel's sample contract has two kinds that need other objects, a routine created after the tables and a type created before them (
DependencyOrderTests). - The second provider's audit test turned over:
A_dependency_on_an_index_says_which_tables_index_it_means.
Not here:
- A place among EF Core's operations, such as a create behind the
EnsureSchemaof its schema: slice C. - An object that stays while what it needs is dropped and created again. Nothing looks at that; on PostgreSQL the drop of a function a trigger uses is refused by the server.
- Nothing that ships states a
Dependency.SchemaObjectyet. The row guard (RowGuard: delete guards as declared triggers, with one raise-only function #47) is the first.
Ten rules were changed in turn and a test failed for each:
| Changed | Fails |
|---|---|
| Creates after the tables in the order they had | A_chain_is_created_from_its_foot_and_dropped_from_its_head, the circle's test |
| Drops before the tables in the order they had | A_chain_is_created_from_its_foot_and_dropped_from_its_head |
| Creates before the tables in the order they had | What_is_created_before_the_tables_cannot_need_what_is_created_after_them |
| Drops after the tables in the order they had | What_tables_are_made_of_is_ordered_among_itself, after a chain of three replaced the pair the first run showed held nothing |
| A type may need a routine | What_is_created_before_the_tables_cannot_need_what_is_created_after_them |
| An undeclared dependency passes | two |
| A snapshot is held to its dependencies too | A_dependency_on_an_object_the_model_does_not_declare_is_refused_in_the_contexts_own_model |
| The scope does not count | An_object_of_the_same_name_in_another_scope_is_not_the_one_that_is_needed |
| The owner does not count | An_object_of_the_same_name_of_another_owner_is_not_the_one_that_is_needed, added after the first run showed nothing held it |
| A circle is taken in the order given | Objects_that_need_each_other_in_a_circle_are_refused_with_their_names |
Part of #115 (decided 2026-11-25), after slice A (#145). What #24 still owes on ordering.
Problem
Creates are ordered by placement and then by the model's order, and drops the other way round. Dependency.SchemaObject says an object needs another, and nothing keeps that order: a trigger declared before its function is created before it. The dependency holds an owner and a name and no scope, so it cannot say which table's object it means (A_dependency_on_an_index_cannot_say_which_tables_index_it_means in the second provider's tests).
Change
Dependency.SchemaObjectgains the object's scope:(Owner, Scope, Name). A case of a closed union of the contract changes, which the maintainer accepted with The plan as ordered actions with a name ledger, not two lists around EF Core's operations #115.- Within a placement's phase a create comes after the creates of what it depends on, and a drop before the drops of what it depends on. Objects that depend on nothing keep the order they have today.
- A cycle is refused, with its members named. A dependency on an object the model does not declare is refused too: it would be created on nothing.
Not here: one ordered list with EF Core's operations (slice C, at the gate of rc.1), and placing a create behind SQLite's rebuild (slice D).
Done when
The planner's tests hold the order of creates and of drops for a chain of three, on a model and in both directions of a diff, the cycle's refusal, and the second provider's audit test turns over: two indexes of one name on two tables are two dependencies.
Activity