This repository was archived by the owner on Sep 11, 2026. It is now read-only.
Repository navigation
Commit 61f246f
authored
Fix schema reconstruction with native numeric results (WordPress#506)
## Summary
Make **schema reconstruction independent of
`PDO::ATTR_STRINGIFY_FETCHES`**. Interpret SQLite's primary-key,
nullability, and uniqueness flags as integers so reconstruction
preserves auto-increment columns, `NOT NULL`, defaults, and unique
indexes in either fetch mode.
Add a regression test that creates an existing SQLite table before
driver initialization and verifies its reconstructed column and index
metadata with string fetching enabled and disabled.
## Why
Reconstruction compared SQLite's numeric flags strictly against strings.
Since connection initialization stopped forcing string results in WordPress#291,
reconstruction can receive integers before WordPress enables string
fetching. This could mark every column in an auto-increment table as
auto-incrementing, causing a later `ALTER TABLE` to fail with "has more
than one primary key."
Related to WordPress#422.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Improved compatibility when SQLite returns column and index metadata
as either strings or integers.
* Information schema reconstruction now consistently handles numeric
metadata values regardless of fetch settings or PHP version.
* Schema and index details are reconstructed more reliably across
different SQLite metadata formats.
* **Tests**
* Added coverage for schema reconstruction with stringified and native
SQLite fetch values.
* Verified reconstructed column metadata and index statistics across
supported configurations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 69340fe commit 61f246f
2 files changed
Lines changed: 61 additions & 3 deletions
File tree
- packages/mysql-on-sqlite
- src/sqlite
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
380 | | - | |
| 380 | + | |
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | | - | |
| 386 | + | |
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
| |||
421 | 421 | | |
422 | 422 | | |
423 | 423 | | |
424 | | - | |
| 424 | + | |
425 | 425 | | |
426 | 426 | | |
427 | 427 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
184 | 242 | | |
185 | 243 | | |
186 | 244 | | |
| |||
0 commit comments