Add SQLite support as alternative database backend

Support config-driven choice between MySQL and SQLite via DB_DRIVER
constant, defaulting to MySQL for backward compatibility. All SQL
adaptation lives in Database.php (UDFs + query rewriting), so model
files need no changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

SQLite: remove FK constraints, revert 0→null sentinel changes

The SQLite schema had FOREIGN KEY constraints that don't exist in the
MySQL schema. These forced a cascade of 0→null changes to satisfy FK
enforcement. Removing them keeps the two backends behaviorally consistent
and minimises the diff. Real SQLite compat fixes (UDFs, query rewriting,
rowCount→count, Router fixes, EditAlbum guard) are preserved.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-14 12:04:42 +01:00
parent b0ee3081a6
commit a71b8c9717
9 changed files with 286 additions and 55 deletions

View File

@@ -10,7 +10,6 @@ class AssetIterator implements Iterator
{
private $direction;
private $return_format;
private $rowCount;
private $assets_iterator;
private $meta_iterator;
@@ -21,7 +20,6 @@ class AssetIterator implements Iterator
{
$this->direction = $direction;
$this->return_format = $return_format;
$this->rowCount = $stmt_assets->rowCount();
$this->assets_iterator = new CachedPDOIterator($stmt_assets);
$this->assets_iterator->rewind();
@@ -209,7 +207,7 @@ class AssetIterator implements Iterator
public function num(): int
{
return $this->rowCount;
return count($this->assets_iterator);
}
public function rewind(): void