Repository navigation
Check foreign keys once per build and per watch batch - #1543
Merged
Merged
Conversation
thekevinbot
marked this pull request as ready for review
October 19, 2026 11:36
2 tasks done
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.
Fixes #1541
Declared foreign keys are checked once per unit of work instead of per row.
PRAGMA defer_foreign_keys = ON, so tables can fill in any order. An orphan at commit fails the build with a message naming the table, the producing file and the unmatched values (frompragma_foreign_key_check), not a bareFOREIGN KEY constraint failed.docs/reference/config.md"Foreign keys".Not deferred, and out of scope:
ON DELETE/ON UPDATEactions. A changed file is applied as delete plus insert, soON DELETE CASCADEdeletes the children of an edited parent. This is documented.E2E Verification
cargo test --workspace --features cli)packages/python/e2e-attestations/<branch>.jsonreceipt written ifpackages/pythonchanged (just e2e-attest-python)packages/ts/e2e-attestations/<branch>.jsonreceipt written ifpackages/tschanged (just e2e-attest-ts)uv run maturin develop --release;cargo build --release -p dirsql --features cli;cd packages/python && testing-conventions e2e attest 'uv run python -m pytest tests/e2e/on_file_query_test.py tests/e2e/use_case_join_test.py tests/e2e/fanout_test.py tests/e2e/query_contract_test.py tests/e2e/declared_table_name_test.py tests/e2e/watch_speed_test.py tests/e2e/server_speed_test.py -x -q';cd packages/ts && testing-conventions e2e attest 'pnpm test:e2e';cargo test --workspace --features clidirsql --watch, editing a referenced parent now applies; deleting a referenced parent gives a named error and keeps the previous state; the held deletion landed once the orphaned children were removed.Changelog / Migrations
packages/rust/changelog.d/for each changed packagepackages/rust/migrations.d/for each changed package