Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sql-statements.mdx #16396

Merged
merged 2 commits into from
Aug 28, 2024
Merged

Conversation

ShaheenFattoe8
Copy link
Contributor

@ShaheenFattoe8 ShaheenFattoe8 commented Aug 22, 2024

Updated to reflect ON DELETE CASCADE behavior when foreign key enforcement is deferred (PRAGMA defer_foreign_keys = on).

Updated to reflect `ON DELETE CASCADE` behavior when foreign key enforcement is deferred (`PRAGMA defer_foreign_keys = on`).
@github-actions github-actions bot added product:d1 D1: https://developers.cloudflare.com/d1/ size/xs labels Aug 22, 2024
@@ -129,6 +129,8 @@ Allows you to defer the enforcement of [foreign key constraints](/d1/build-with-

This does not disable foreign key enforcement outside of the current transaction: if you have not resolved outstanding foreign key violations at the end of your transaction, it will fail with a `FOREIGN KEY constraint failed` error.

Note that setting `PRAGMA defer_foreign_keys = on` does not prevent `ON DELETE CASCADE` actions from being executed. While foreign key enforcement is deferred, `ON DELETE CASCADE` operations will still be active during a transaction.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • try to combine sentences since they echo each other
  • mention that this behavior is similar to sqlite (worth testing with sqlite to confirm)

Updated text to show D1 behavior is consistent with SQLite behavior.
@vy-ton vy-ton merged commit 1b70fd4 into cloudflare:production Aug 28, 2024
6 checks passed
elithrar pushed a commit that referenced this pull request Oct 15, 2024
Updated to reflect `ON DELETE CASCADE` behavior when foreign key enforcement is deferred (`PRAGMA defer_foreign_keys = on`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product:d1 D1: https://developers.cloudflare.com/d1/ size/xs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants