Repository navigation
Description
Found by the pre-tag review of 948496a..0ee827d (the review for v11.0.0-preview.1). Each change below was applied to the planner on its own, and the offline suites (kernel, PostgreSQL, second provider) still passed. No live test covers them either.
1. Lost against RebuildAround
SchemaOperationPlanner (Weight, around line 384) gives RebuildAround more weight than Lost, so when one migration does both to the same object, rebuilding around it wins. Seed: Impact.Lost => 4. No test fails. Every drop test in PgExclusionLiveTests drops one column.
Scenario: a migration drops both an element column (Lost) and a column only the condition reads (RebuildAround) of the same exclusion constraint. With the order reversed, the constraint is not dropped before EF Core's operations. The migration then fails with 2BP01 or happens to work, depending on which column EF Core drops first. That failure is loud, not silent.
A test that holds it (it passes on 0ee827d and fails under the seed):
public sealed class WithoutRoleAndRevocation : ITestModel
{
public static void Build(ModelBuilder modelBuilder)
{
var grants = modelBuilder.Entity<RoleGrant>().ToTable("role_grants");
grants.Ignore(x => x.RoleId);
grants.Ignore(x => x.RevokedOn);
grants.DeclarePostgres(pg =>
[pg.Exclusion(pg.Equal(x => x.GranteeId).Overlaps(x => x.Period), deferral: Deferral.InitiallyDeferred, name: Models.Name)]);
}
}
[TestMethod]
public void The_answer_that_asks_most_decides_RebuildAround_over_Lost()
{
var shape = Contexts.Diff<Models.Scheduling, WithoutRoleAndRevocation>().Shape();
Assert.AreEqual("ALTER TABLE role_grants DROP CONSTRAINT ex_role_grant_active_period;",
shape.SkipWhile(s => s.StartsWith("CREATE EXTENSION")).First());
}It should also get a row in PgExclusionLiveTests.
2. KeepInPlace: a dropped BeforeTables object still holds its name
Held keeps the claims of a dropped object whose contributor is BeforeTables, since such an object is dropped after EF Core's operations (if (dropped.Contains(source) && !source.Contributor.Placement.IsBeforeTables) continue;). Seed: take out && !…IsBeforeTables. No test fails, because no test contributor is BeforeTables. If this broke, a rename in place would collide when the migration is applied, which is loud.
3. KeepInPlace: held.AddRange(takes)
Seed: remove the line that records a change's new names after it is written. No test fails. Two renames in one migration that take one name are already refused by the own-model name check (NameClaims.Require), so the line cannot be reached today. Either hold it with a test that gets around that check, or say in a comment why it is defensive only.
Does it block preview.1?
No. All three are missing tests for rules that hold today, and each failure they would let through is loud.
Activity