Commit 67f5f46
sqlite: enable foreign key constraints by default
For historical reasons and to maintain compatibibility with legacy
database schemas, SQLite does not enable foreign key constraints by
default. For new applications, however, this behavior is undesirable.
Currently, any application that wishes to use foreign keys must use
PRAGMA foreign_keys = ON;
to explicitly enable enforcement of such constraints.
This commit changes the behavior of the SQLite API built into Node.js
to enable foreign key constraints by default. This behavior can be
overridden by users to maintain compatibility with legacy database
schemas.
PR-URL: #54777
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent f703652 commit 67f5f46Copy full SHA for 67f5f46
File tree
Expand file treeCollapse file tree
4 files changed
+78
-3
lines changedOpen diff view settings
Filter options
- doc/api
- src
- test/parallel
Expand file treeCollapse file tree
4 files changed
+78
-3
lines changedOpen diff view settings
Collapse file
+6Lines changed: 6 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
107 | 107 | |
108 | 108 | |
109 | 109 | |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + |
110 | 115 | |
111 | 116 | |
112 | 117 | |
| ||
317 | 322 | |
318 | 323 | |
319 | 324 | |
| 325 | + |
320 | 326 | |
321 | 327 | |
322 | 328 | |
|
Collapse file
+33-2Lines changed: 33 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
91 | 91 | |
92 | 92 | |
93 | 93 | |
94 | | - |
| 94 | + |
| 95 | + |
95 | 96 | |
96 | 97 | |
97 | 98 | |
98 | 99 | |
99 | 100 | |
| 101 | + |
100 | 102 | |
101 | 103 | |
102 | 104 | |
| ||
125 | 127 | |
126 | 128 | |
127 | 129 | |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | + |
| 138 | + |
128 | 139 | |
129 | 140 | |
130 | 141 | |
| ||
166 | 177 | |
167 | 178 | |
168 | 179 | |
| 180 | + |
169 | 181 | |
170 | 182 | |
171 | 183 | |
| ||
188 | 200 | |
189 | 201 | |
190 | 202 | |
| 203 | + |
| 204 | + |
| 205 | + |
| 206 | + |
| 207 | + |
| 208 | + |
| 209 | + |
| 210 | + |
| 211 | + |
| 212 | + |
| 213 | + |
| 214 | + |
| 215 | + |
| 216 | + |
| 217 | + |
| 218 | + |
| 219 | + |
| 220 | + |
191 | 221 | |
192 | 222 | |
193 | | - |
| 223 | + |
| 224 | + |
194 | 225 | |
195 | 226 | |
196 | 227 | |
|
Collapse file
+3-1Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
21 | 21 | |
22 | 22 | |
23 | 23 | |
24 | | - |
| 24 | + |
| 25 | + |
25 | 26 | |
26 | 27 | |
27 | 28 | |
| ||
43 | 44 | |
44 | 45 | |
45 | 46 | |
| 47 | + |
46 | 48 | |
47 | 49 | |
48 | 50 | |
|
Collapse file
test/parallel/test-sqlite-database-sync.js
Copy file name to clipboardExpand all lines: test/parallel/test-sqlite-database-sync.js+36Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
50 | 50 | |
51 | 51 | |
52 | 52 | |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | + |
53 | 89 | |
54 | 90 | |
55 | 91 | |
|
0 commit comments