You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Dropping both tables of a temporal foreign key fails when the principal sorts first, Down() included #79
area/constraintsTemporal (WITHOUT OVERLAPS, PERIOD) and exclusion constraintsarea/migrationsThe differs, snapshot format, EnsureCreated and design-time wiringbugSomething isn't workingpackage/postgresqlAffects EFCore.ComplexIndexes.PostgreSQLseverity/mediumInconsistency or failure in a narrow scenario
When a migration drops both the principal table of a temporal foreign key and its dependent table, the FK drop is skipped (the dependent table is being dropped anyway), and EF orders the DropTable operations without knowing about the temporal FK. If the principal sorts first, the migration fails:
model: a_rooms (HasTemporalConstraint) ← b_bookings (HasTemporalForeignKey to a_rooms)
diff to a model without both:
DROP TABLE a_rooms; -- 2BP01 cannot drop table a_rooms because other objects depend on it
DROP TABLE b_bookings;
The Down() of the migration that created the two tables has the same shape, so dotnet ef database update <previous> and migrations remove after applying cannot roll back. Whether it fails depends only on the table names.
Cause: ApplyTemporalConstraints drops a temporal FK only when its dependent table survives (pendingForeignKeyDrops).
Fix
Emit the FK drop before the base operations whenever the principal table is dropped, even if the dependent is dropped too. Test: diff the model above to an empty model, assert a DropForeignKeyOperation precedes the first DropTableOperation, and apply it in PostgresIntegrationTests.
Loud. Found by the 5.5.0 pre-tag analysis; present since temporal FKs shipped.
area/constraintsTemporal (WITHOUT OVERLAPS, PERIOD) and exclusion constraintsarea/migrationsThe differs, snapshot format, EnsureCreated and design-time wiringbugSomething isn't workingpackage/postgresqlAffects EFCore.ComplexIndexes.PostgreSQLseverity/mediumInconsistency or failure in a narrow scenario
Activity
Merge pull request #102 from CaffeinatedCoder/fix/79-temporal-fk-drop…