diff --git a/docs/development/docker.md b/docs/development/docker.md index d065c40..a386341 100644 --- a/docs/development/docker.md +++ b/docs/development/docker.md @@ -175,12 +175,13 @@ NENE_DB_TYPE=SQLite3 NENE_DB_FILE=nene.db docker compose up --build app ## Schema Parity Between SQLite and MySQL -NeNe initializes two separate development databases through two separate scripts: +NeNe initializes the sample database through **three** independent code paths: -- `cli/initSQLite.php` — PHP code that creates SQLite tables and `updated_at` triggers when the SQLite3 fallback is used. - `docker/mysql/init/001_schema.sql` — declarative SQL applied by the MySQL container on first boot under Docker Compose. +- `cli/initSQLite.php` — legacy PHP CLI that creates SQLite tables and `updated_at` triggers. Maintained for backwards compatibility; new deployment guides should prefer `cli/setupDatabase.php`. +- `class/xion/DatabaseInstaller.php` — the generic installer invoked by `cli/setupDatabase.php`. Holds inline CREATE TABLE statements for both MySQL and SQLite paths. This is the canonical installation path. -These files **do not share a source of truth**. Nothing in CI enforces parity between them. When a contributor adds or alters a table, both files must be edited in the same change, and both runtimes must be verified locally. +These three sites **do not share a source of truth**. Nothing in CI enforces parity. When a contributor adds or alters a table, **all three** must be edited in the same change, and both runtimes verified locally. When in doubt about whether the two paths agree, compare the table sets: diff --git a/docs/review/database.md b/docs/review/database.md index 46531a5..bf3f50e 100644 --- a/docs/review/database.md +++ b/docs/review/database.md @@ -10,7 +10,7 @@ Source policies: ## Checklist -- [ ] Schema changes are mirrored in **both** `docker/mysql/init/001_schema.sql` **and** `cli/initSQLite.php`. The two files do not share a source of truth; CI does not enforce parity. +- [ ] Schema changes are mirrored in **all three** locations: `docker/mysql/init/001_schema.sql`, `cli/initSQLite.php`, and `class/xion/DatabaseInstaller.php` (used by `cli/setupDatabase.php`). The three sites do not share a source of truth; CI does not enforce parity. - [ ] SQLite path includes an `..._updated_at_trigger` to mirror MySQL's `ON UPDATE CURRENT_TIMESTAMP`. - [ ] Foreign keys cascade-delete or restrict deliberately; the choice matches the entity lifecycle. - [ ] Per-user tables expose `user_id` as a `BIGINT UNSIGNED` FK to `users.id`, indexed (`KEY ..._user_id_index`).