You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Schema: schema caching and rebuilding across tests #125
Part of #102. Line numbers refer to branch chore/php-8.4-dependabot (#98). Verified = reproduced, suspected = from reading the code.
The static $executedStatements cache is keyed by SQL string and is append-only. If class B defines user with one more column than class A, the run fails with table user already exists (SqliteFileBasedSchemaStrategy.php:107-113, MysqlBasedSchemaStrategy.php:44-50, MysqlDamaBasedSchemaStrategy.php:47-53). Verified (SQLite file), suspected for MySQL.
The SQLite file DAMA strategy runs CREATE TABLE unconditionally (SqliteFileDamaBasedSchemaStrategy.php:44-46). If the file already has tables, every test fails with table already exists. This happens e.g. after a test with #[SkipDatabaseRollback] switched to the non-DAMA strategy, or after a run with DAMA disabled. Verified (emulated).
The SQLite file strategy unlinks the database file under an already open connection, so CREATE runs on the deleted inode (SqliteFileBasedSchemaStrategy.php:66-70). Verified.
SQLite memory runs CREATE TABLE unconditionally, so a second fixture on the same connection fails (SqliteMemoryBasedSchemaStrategy.php:22-27). Verified.
Nested database directories are not created, because mkdir() isn't recursive (SqliteFile*SchemaStrategy). Verified.
Possible approach: a schema-aware rebuild via DBAL's Comparator instead of the SQL-string cache, and a schema cache that survives between runs, keyed by a schema hash.
Activity
fix(schema): Rebuild the schema for changed table definitions and kee…