Skip to content

Conversation

JanJakes
Copy link
Member

This PR merges the changes from the Automattic SQLite fork as Automattic is resuming WordPress contributions.

The fork will be archived and can be found here: https://github.com/Automattic/sqlite-database-integration

List or PRs: https://github.com/Automattic/sqlite-database-integration/pulls?q=is%3Apr

Let's merge this PR as is without squashing. These individual commits carry a lot of context.

JanJakes and others added 30 commits December 20, 2024 12:36
JanJakes and others added 28 commits April 24, 2025 10:57
Co-authored-by: Adam Zieliński <adam@adamziel.com>
Fix deprecation of implicitly marking parameter as nullable in PHP 8.4
Add PHP 8.4 unit tests to CI
Database configuration and migration
The new SQLite driver already uses some features from PHP 7.2.

WordPress [recommends](https://wordpress.org/about/requirements/) PHP
7.4+ and requires PHP 7.2.24+.

Closes
Automattic/sqlite-database-integration#12.
The information schema builder requires a few small touches for the new
driver release:

- [X] It creates some tables that we don't support yet — let's remove
those queries.
- [X] It doesn't maintain the `table_constraints` table. This table will
be needed in the future, and since it also store some information about
primary and unique constraints, let's store it now, so we don't have to
backfill it with a migration later on.
- [X] Make sure identifiers are case-insensitive
- [X] Verify index and constraint naming — e.g., what happens when both
constraint name and index name are specified, and how duplicate names
are handled.
**List of discovered issues:**

- [x] Data types from `_mysql_data_types_cache` are sometimes not
correctly fetched, as they can be saved in multiple formates (lowercase,
uppercase, with or without backticks).
- [x] MySQL applies type casting when saving data in non-strict mode,
resulting in things like empty string being saved as `0` for an integer,
`0000-00-00 00:00:00` for a date, etc.
- [x] Functional defaults are incorrectly applied in non-strict mode
(`DEFAULT CURRENT_TIMESTAMP` saves a `'CURRENT_TIMESTAMP'` string rather
than the correct value).
- [x] MySQL `BINARY` type is saved as `INTEGER`, but it's actually a
binary string, and `BLOB` would be more suitable.
- [x] MySQL supports date and time components without a zero padding,
but that doesn't work with date and time functions in SQLite. (E.g.:
`2025-3-7 9:5:2` is a valid datetime/timestamp value in MySQL, but
SQLite requires it to be `2025-03-07 09:05:02`.)
- [x] In multi-process environments (php-fpm), concurrent writes can
cause "SQLSTATE[HY000]: General error: 5 database is locked"
(`SQLITE_BUSY`).
@JanJakes JanJakes requested a review from adamziel May 30, 2025 13:25
@adamziel adamziel merged commit 4cfe524 into develop May 30, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants